Merge "Fix issue #3117472: Format storage dialog still broken" into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
e9dbf208e4
@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.internal.app;
|
||||
|
||||
import com.android.internal.os.storage.ExternalStorageFormatter;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@ -23,10 +25,6 @@ import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.IMountService;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
@ -95,14 +93,9 @@ public class ExternalMediaFormatActivity extends AlertActivity implements Dialog
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
if (which == POSITIVE_BUTTON) {
|
||||
IMountService mountService = IMountService.Stub.asInterface(ServiceManager
|
||||
.getService("mount"));
|
||||
if (mountService != null) {
|
||||
try {
|
||||
mountService.formatVolume(Environment.getExternalStorageDirectory().toString());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
Intent intent = new Intent(ExternalStorageFormatter.FORMAT_ONLY);
|
||||
intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME);
|
||||
startService(intent);
|
||||
}
|
||||
|
||||
// No matter what, finish the activity
|
||||
|
Reference in New Issue
Block a user