Merge "DO NOT MERGE Removing unused features from source tree. Please refer to Bug#2502219." into froyo
diff --git a/src/com/android/settings/DeviceAdminAdd.java b/src/com/android/settings/DeviceAdminAdd.java
index 2653e81..4760277 100644
--- a/src/com/android/settings/DeviceAdminAdd.java
+++ b/src/com/android/settings/DeviceAdminAdd.java
@@ -27,6 +27,7 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.Intent;
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
@@ -81,6 +82,12 @@
         
         mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
 
+        if ((getIntent().getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0) {
+            Log.w(TAG, "Can now start ADD_DEVICE_ADMIN as a new task");
+            finish();
+            return;
+        }
+        
         ComponentName cn = (ComponentName)getIntent().getParcelableExtra(
                 DevicePolicyManager.EXTRA_DEVICE_ADMIN);
         if (cn == null) {
diff --git a/src/com/android/settings/InstalledAppDetails.java b/src/com/android/settings/InstalledAppDetails.java
index 1f0e690..fb1fbf7 100644
--- a/src/com/android/settings/InstalledAppDetails.java
+++ b/src/com/android/settings/InstalledAppDetails.java
@@ -202,8 +202,10 @@
                 return getString(R.string.invalid_location);
             case PackageManager.MOVE_FAILED_SYSTEM_PACKAGE:
                 return getString(R.string.system_package);
+            case PackageManager.MOVE_FAILED_INTERNAL_ERROR:
+                return "";
         }
-        return null;
+        return "";
     }
 
     private void initMoveButton() {
diff --git a/src/com/android/settings/MediaFormat.java b/src/com/android/settings/MediaFormat.java
index 71d2766..075534d 100644
--- a/src/com/android/settings/MediaFormat.java
+++ b/src/com/android/settings/MediaFormat.java
@@ -64,15 +64,19 @@
                 if (Utils.isMonkeyRunning()) {
                     return;
                 }
-                IMountService service =
+                final IMountService service =
                         IMountService.Stub.asInterface(ServiceManager.getService("mount"));
                 if (service != null) {
-                    try {
-                        service.formatVolume(Environment.getExternalStorageDirectory().toString());
-                    } catch (android.os.RemoteException e) {
-                        // Intentionally blank - there's nothing we can do here
-                        Log.w("MediaFormat", "Unable to invoke IMountService.formatMedia()");
-                    }
+                    new Thread() {
+                        public void run() {
+                            try {
+                                service.formatVolume(Environment.getExternalStorageDirectory().toString());
+                            } catch (Exception e) {
+                                // Intentionally blank - there's nothing we can do here
+                                Log.w("MediaFormat", "Unable to invoke IMountService.formatMedia()");
+                            }
+                        }
+                    }.start();
                 } else {
                     Log.w("MediaFormat", "Unable to locate IMountService");
                 }