Update MountService to StorageManagerService.

Bug: 30977067
Test: N/A
Change-Id: I8c5eda7ed068bc7c184d559c0a27c52a74094f1a
This commit is contained in:
Sudheer Shanka
2016-11-09 15:47:53 -08:00
parent 2c61018618
commit ee2d592c72
4 changed files with 16 additions and 16 deletions

View File

@@ -35,7 +35,7 @@ import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.storage.IMountService; import android.os.storage.IStorageManager;
import android.os.storage.StorageManager; import android.os.storage.StorageManager;
import android.provider.Settings; import android.provider.Settings;
import android.telecom.TelecomManager; import android.telecom.TelecomManager;
@@ -182,7 +182,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
@Override @Override
protected Integer doInBackground(String... params) { protected Integer doInBackground(String... params) {
final IMountService service = getMountService(); final IStorageManager service = getStorageManager();
try { try {
return service.decryptStorage(params[0]); return service.decryptStorage(params[0]);
} catch (Exception e) { } catch (Exception e) {
@@ -253,7 +253,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
} else { } else {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD; int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
try { try {
final IMountService service = getMountService(); final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType(); passwordType = service.getPasswordType();
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e); Log.e(TAG, "Error calling mount service " + e);
@@ -289,7 +289,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
@Override @Override
protected Boolean doInBackground(Void... params) { protected Boolean doInBackground(Void... params) {
final IMountService service = getMountService(); final IStorageManager service = getStorageManager();
try { try {
Log.d(TAG, "Validating encryption state."); Log.d(TAG, "Validating encryption state.");
state = service.getEncryptionState(); state = service.getEncryptionState();
@@ -483,7 +483,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
@Override @Override
public Void doInBackground(Void... v) { public Void doInBackground(Void... v) {
try { try {
final IMountService service = getMountService(); final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType(); passwordType = service.getPasswordType();
owner_info = service.getField(StorageManager.OWNER_INFO_KEY); owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY))); pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
@@ -865,10 +865,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|| imm.getEnabledInputMethodSubtypeList(null, false).size() > 1; || imm.getEnabledInputMethodSubtypeList(null, false).size() > 1;
} }
private IMountService getMountService() { private IStorageManager getStorageManager() {
final IBinder service = ServiceManager.getService("mount"); final IBinder service = ServiceManager.getService("mount");
if (service != null) { if (service != null) {
return IMountService.Stub.asInterface(service); return IStorageManager.Stub.asInterface(service);
} }
return null; return null;
} }

View File

@@ -25,7 +25,7 @@ import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.storage.IMountService; import android.os.storage.IStorageManager;
import android.provider.Settings; import android.provider.Settings;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@@ -83,10 +83,10 @@ public class CryptKeeperConfirm extends InstrumentedFragment {
return; return;
} }
IMountService mountService = IMountService.Stub.asInterface(service); IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try { try {
Bundle args = getIntent().getExtras(); Bundle args = getIntent().getExtras();
mountService.encryptStorage(args.getInt("type", -1), args.getString("password")); storageManager.encryptStorage(args.getInt("type", -1), args.getString("password"));
} catch (Exception e) { } catch (Exception e) {
Log.e("CryptKeeper", "Error while encrypting...", e); Log.e("CryptKeeper", "Error while encrypting...", e);
} }
@@ -140,8 +140,8 @@ public class CryptKeeperConfirm extends InstrumentedFragment {
// 2. The system locale. // 2. The system locale.
try { try {
IBinder service = ServiceManager.getService("mount"); IBinder service = ServiceManager.getService("mount");
IMountService mountService = IMountService.Stub.asInterface(service); IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
mountService.setField("SystemLocale", Locale.getDefault().toLanguageTag()); storageManager.setField("SystemLocale", Locale.getDefault().toLanguageTag());
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Error storing locale for decryption UI", e); Log.e(TAG, "Error storing locale for decryption UI", e);
} }

View File

@@ -54,7 +54,7 @@ import android.os.StrictMode;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.UserManager; import android.os.UserManager;
import android.os.storage.IMountService; import android.os.storage.IStorageManager;
import android.provider.SearchIndexableResource; import android.provider.SearchIndexableResource;
import android.provider.Settings; import android.provider.Settings;
import android.service.persistentdata.PersistentDataBlockManager; import android.service.persistentdata.PersistentDataBlockManager;
@@ -489,8 +489,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
try { try {
IBinder service = ServiceManager.getService("mount"); IBinder service = ServiceManager.getService("mount");
IMountService mountService = IMountService.Stub.asInterface(service); IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
if (!mountService.isConvertibleToFBE()) { if (!storageManager.isConvertibleToFBE()) {
removePreference(KEY_CONVERT_FBE); removePreference(KEY_CONVERT_FBE);
} else if ("file".equals(SystemProperties.get("ro.crypto.type", "none"))) { } else if ("file".equals(SystemProperties.get("ro.crypto.type", "none"))) {
convertFbePreference.setEnabled(false); convertFbePreference.setEnabled(false);

View File

@@ -77,7 +77,7 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase {
public void onNavigateNext() { public void onNavigateNext() {
int moveId; int moveId;
// We only expect exceptions from MountService#setPrimaryStorageUuid // We only expect exceptions from StorageManagerService#setPrimaryStorageUuid
try { try {
moveId = getPackageManager().movePrimaryStorage(mVolume); moveId = getPackageManager().movePrimaryStorage(mVolume);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {