Settings: Fix for http://b/issue?id=2538399 (ANR while formatting sd)
Change-Id: I94b84a45557cbce706c37d5088d398283a639c80 Signed-off-by: San Mehat <san@google.com>
This commit is contained in:
@@ -64,15 +64,19 @@ public class MediaFormat extends Activity {
|
||||
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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user