Settings: Refactor for new API and remove some unused references / imports
Signed-off-by: San Mehat <san@google.com>
This commit is contained in:
@@ -27,7 +27,6 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.IMountService;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.preference.CheckBoxPreference;
|
||||
|
@@ -23,7 +23,7 @@ import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.IMountService;
|
||||
import android.os.storage.IMountService;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.Environment;
|
||||
|
@@ -24,9 +24,10 @@ import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Environment;
|
||||
import android.os.IMountService;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.StatFs;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.os.storage.IMountService;
|
||||
import android.text.format.Formatter;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@@ -45,6 +46,7 @@ public class SdCardSettings extends Activity
|
||||
|
||||
setContentView(R.layout.sdcard_settings_screen);
|
||||
|
||||
mStorageManager = (StorageManager) getSystemService(Context.STORAGE_SERVICE);
|
||||
mMountService = IMountService.Stub.asInterface(ServiceManager.getService("mount"));
|
||||
|
||||
mRemovedLayout = findViewById(R.id.removed);
|
||||
@@ -105,10 +107,7 @@ public class SdCardSettings extends Activity
|
||||
private void update() {
|
||||
|
||||
try {
|
||||
String path = Environment.getExternalStorageDirectory().getPath();
|
||||
mMassStorage.setChecked(
|
||||
mMountService.getVolumeShared(
|
||||
Environment.getExternalStorageDirectory().getPath(), "ums"));
|
||||
mMassStorage.setChecked(mStorageManager.isUsbMassStorageEnabled());
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
@@ -158,11 +157,9 @@ public class SdCardSettings extends Activity
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
if (mMassStorage.isChecked()) {
|
||||
mMountService.shareVolume(
|
||||
Environment.getExternalStorageDirectory().getPath(), "ums");
|
||||
mStorageManager.enableUsbMassStorage();
|
||||
} else {
|
||||
mMountService.unshareVolume(
|
||||
Environment.getExternalStorageDirectory().getPath(), "ums");
|
||||
mStorageManager.disableUsbMassStorage();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
@@ -194,6 +191,7 @@ public class SdCardSettings extends Activity
|
||||
}
|
||||
};
|
||||
|
||||
private StorageManager mStorageManager;
|
||||
private IMountService mMountService;
|
||||
|
||||
private CheckBox mMassStorage;
|
||||
|
@@ -25,7 +25,6 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.IMountService;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.preference.CheckBoxPreference;
|
||||
@@ -59,8 +58,6 @@ public class SoundSettings extends PreferenceActivity implements
|
||||
|
||||
private CheckBoxPreference mSilent;
|
||||
|
||||
private IMountService mMountService = null;
|
||||
|
||||
/*
|
||||
* If we are currently in one of the silent modes (the ringer mode is set to either
|
||||
* "silent mode" or "vibrate mode"), then toggling the "Phone vibrate"
|
||||
@@ -95,8 +92,6 @@ public class SoundSettings extends PreferenceActivity implements
|
||||
|
||||
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
|
||||
mMountService = IMountService.Stub.asInterface(ServiceManager.getService("mount"));
|
||||
|
||||
addPreferencesFromResource(R.xml.sound_settings);
|
||||
|
||||
if (TelephonyManager.PHONE_TYPE_CDMA != activePhoneType) {
|
||||
|
@@ -25,11 +25,11 @@ import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Environment;
|
||||
import android.os.IMountService;
|
||||
import android.os.storage.IMountService;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.StatFs;
|
||||
import android.storage.StorageManager;
|
||||
import android.storage.StorageEventListener;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.os.storage.StorageEventListener;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceScreen;
|
||||
@@ -95,16 +95,6 @@ public class Memory extends PreferenceActivity {
|
||||
}
|
||||
|
||||
StorageEventListener mStorageListener = new StorageEventListener() {
|
||||
public void onShareAvailabilityChanged(String method, boolean available) {
|
||||
}
|
||||
|
||||
public void onMediaInserted(String label, String path, int major, int minor) {
|
||||
updateMemoryStatus();
|
||||
}
|
||||
|
||||
public void onMediaRemoved(String label, String path, int major, int minor, boolean clean) {
|
||||
updateMemoryStatus();
|
||||
}
|
||||
|
||||
public void onVolumeStateChanged(
|
||||
String label, String path, String oldState, String newState) {
|
||||
|
Reference in New Issue
Block a user