From 2250d56a0b47b93016018340c8f4040325aa5611 Mon Sep 17 00:00:00 2001 From: Sudheer Shanka <sudheersai@google.com> Date: Mon, 7 Nov 2016 15:41:02 -0800 Subject: [PATCH] Rename MountService to StorageManagerService. Bug: 30977067 Test: Existing tests pass Change-Id: Ieac0f11c2b249dcd60441b14c1f391e6f8131d42 --- Android.mk | 6 +- CleanSpec.mk | 1 + cmds/sm/src/com/android/commands/sm/Sm.java | 6 +- compiled-classes-phone | 18 ++-- core/java/android/app/ContextImpl.java | 7 +- .../android/content/pm/IPackageManager.aidl | 2 +- .../os/storage/IObbActionListener.aidl | 2 +- ...stener.aidl => IStorageEventListener.aidl} | 8 +- ...MountService.aidl => IStorageManager.aidl} | 42 ++++----- ...ver.aidl => IStorageShutdownObserver.aidl} | 4 +- .../android/os/storage/StorageManager.java | 92 +++++++++---------- ...ernal.java => StorageManagerInternal.java} | 2 +- .../android/os/storage/StorageResultCode.java | 2 +- core/java/android/provider/Settings.java | 3 +- .../internal/content/PackageHelper.java | 52 +++++------ .../internal/widget/LockPatternUtils.java | 18 ++-- .../content/pm/PackageHelperTests.java | 14 +-- .../content/pm/PackageManagerTests.java | 14 +-- .../src/android/os/storage/AsecTests.java | 78 ++++++++-------- libs/storage/IMountService.cpp | 2 +- libs/storage/IMountServiceListener.cpp | 2 +- libs/storage/IMountShutdownObserver.cpp | 2 +- .../BackupRestoreConfirmation.java | 14 +-- .../providers/settings/DatabaseHelper.java | 2 +- preloaded-classes | 6 +- .../server/backup/BackupManagerService.java | 14 +-- .../com/android/server/AppOpsService.java | 10 +- .../com/android/server/EventLogTags.logtags | 2 +- .../android/server/LockSettingsService.java | 16 ++-- .../com/android/server/MountServiceIdler.java | 2 +- ...ervice.java => StorageManagerService.java} | 75 +++++++-------- .../server/am/ActivityManagerService.java | 14 +-- .../com/android/server/am/UserController.java | 10 +- .../server/pm/PackageManagerService.java | 41 +++++---- .../android/server/power/ShutdownThread.java | 22 ++--- .../java/com/android/server/SystemServer.java | 28 +++--- 36 files changed, 319 insertions(+), 314 deletions(-) rename core/java/android/os/storage/{IMountServiceListener.aidl => IStorageEventListener.aidl} (89%) rename core/java/android/os/storage/{IMountService.aidl => IStorageManager.aidl} (90%) rename core/java/android/os/storage/{IMountShutdownObserver.aidl => IStorageShutdownObserver.aidl} (91%) rename core/java/android/os/storage/{MountServiceInternal.java => StorageManagerInternal.java} (98%) rename services/core/java/com/android/server/{MountService.java => StorageManagerService.java} (98%) diff --git a/Android.mk b/Android.mk index cd738e7e1d65..552103d4d1a5 100644 --- a/Android.mk +++ b/Android.mk @@ -245,9 +245,9 @@ LOCAL_SRC_FILES += \ core/java/android/os/IUpdateLock.aidl \ core/java/android/os/IUserManager.aidl \ core/java/android/os/IVibratorService.aidl \ - core/java/android/os/storage/IMountService.aidl \ - core/java/android/os/storage/IMountServiceListener.aidl \ - core/java/android/os/storage/IMountShutdownObserver.aidl \ + core/java/android/os/storage/IStorageManager.aidl \ + core/java/android/os/storage/IStorageEventListener.aidl \ + core/java/android/os/storage/IStorageShutdownObserver.aidl \ core/java/android/os/storage/IObbActionListener.aidl \ core/java/android/security/IKeystoreService.aidl \ core/java/android/security/keymaster/IKeyAttestationApplicationIdProvider.aidl \ diff --git a/CleanSpec.mk b/CleanSpec.mk index cee8fdb9a856..71e6af7e90fb 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -241,6 +241,7 @@ $(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framewo $(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/APPS/FeatureSplit1_intermediates/src/com/android/test/split/feature/R.java) $(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/APPS/FeatureSplit2_intermediates/src/com/android/test/split/feature/R.java) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/hardware) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/core/java/android/os/storage/*) # ****************************************************************** # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java index d527ad73b787..4291c7768198 100644 --- a/cmds/sm/src/com/android/commands/sm/Sm.java +++ b/cmds/sm/src/com/android/commands/sm/Sm.java @@ -20,7 +20,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.os.storage.DiskInfo; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.os.storage.VolumeInfo; import android.util.Log; @@ -28,7 +28,7 @@ import android.util.Log; public final class Sm { private static final String TAG = "Sm"; - IMountService mSm; + IStorageManager mSm; private String[] mArgs; private int mNextArg; @@ -55,7 +55,7 @@ public final class Sm { throw new IllegalArgumentException(); } - mSm = IMountService.Stub.asInterface(ServiceManager.getService("mount")); + mSm = IStorageManager.Stub.asInterface(ServiceManager.getService("mount")); if (mSm == null) { throw new RemoteException("Failed to find running mount service"); } diff --git a/compiled-classes-phone b/compiled-classes-phone index 03b568458c1c..f09bad93132e 100644 --- a/compiled-classes-phone +++ b/compiled-classes-phone @@ -3223,17 +3223,17 @@ android.os.health.HealthStatsParceler android.os.health.SystemHealthManager android.os.storage.DiskInfo android.os.storage.DiskInfo$1 -android.os.storage.IMountService -android.os.storage.IMountService$Stub -android.os.storage.IMountService$Stub$Proxy -android.os.storage.IMountServiceListener -android.os.storage.IMountServiceListener$Stub -android.os.storage.IMountServiceListener$Stub$Proxy -android.os.storage.IMountShutdownObserver +android.os.storage.IStorageManager +android.os.storage.IStorageManager$Stub +android.os.storage.IStorageManager$Stub$Proxy +android.os.storage.IStorageEventListener +android.os.storage.IStorageEventListener$Stub +android.os.storage.IStorageEventListener$Stub$Proxy +android.os.storage.IStorageShutdownObserver android.os.storage.IObbActionListener android.os.storage.IObbActionListener$Stub -android.os.storage.MountServiceInternal -android.os.storage.MountServiceInternal$ExternalStorageMountPolicy +android.os.storage.StorageManagerInternal +android.os.storage.StorageManagerInternal$ExternalStorageMountPolicy android.os.storage.StorageEventListener android.os.storage.StorageManager android.os.storage.StorageManager$ObbActionListener diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 970e9ac226c0..827e02696e2b 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -61,7 +61,7 @@ import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.system.ErrnoException; import android.system.Os; import android.system.OsConstants; @@ -2213,10 +2213,11 @@ class ContextImpl extends Context { if (!dir.exists()) { // Failing to mkdir() may be okay, since we might not have // enough permissions; ask vold to create on our behalf. - final IMountService mount = IMountService.Stub.asInterface( + final IStorageManager storageManager = IStorageManager.Stub.asInterface( ServiceManager.getService("mount")); try { - final int res = mount.mkdirs(getPackageName(), dir.getAbsolutePath()); + final int res = storageManager.mkdirs( + getPackageName(), dir.getAbsolutePath()); if (res != 0) { Log.w(TAG, "Failed to ensure " + dir + ": " + res); dir = null; diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 11f0eb626964..d753a6eaa1c6 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -492,7 +492,7 @@ interface IPackageManager { /** * Update status of external media on the package manager to scan and * install packages installed on the external media. Like say the - * MountService uses this to call into the package manager to update + * StorageManagerService uses this to call into the package manager to update * status of sdcard. */ void updateExternalMediaStatus(boolean mounted, boolean reportStatus); diff --git a/core/java/android/os/storage/IObbActionListener.aidl b/core/java/android/os/storage/IObbActionListener.aidl index 61ba4d56e6a3..a86ba598c6d3 100644 --- a/core/java/android/os/storage/IObbActionListener.aidl +++ b/core/java/android/os/storage/IObbActionListener.aidl @@ -17,7 +17,7 @@ package android.os.storage; /** - * Callback class for receiving events from MountService about Opaque Binary + * Callback class for receiving events from StorageManagerService about Opaque Binary * Blobs (OBBs). * * Don't change the existing transaction Ids as they could be used in the native code. diff --git a/core/java/android/os/storage/IMountServiceListener.aidl b/core/java/android/os/storage/IStorageEventListener.aidl similarity index 89% rename from core/java/android/os/storage/IMountServiceListener.aidl rename to core/java/android/os/storage/IStorageEventListener.aidl index 0e20cd326585..4ba1dbed1652 100644 --- a/core/java/android/os/storage/IMountServiceListener.aidl +++ b/core/java/android/os/storage/IStorageEventListener.aidl @@ -21,15 +21,15 @@ import android.os.storage.VolumeInfo; import android.os.storage.VolumeRecord; /** - * Callback class for receiving events from MountService. + * Callback class for receiving events from StorageManagerService. * * Don't change the existing transaction Ids as they could be used in the native code. * When adding a new method, assign the next available transaction id. * - * @hide - Applications should use IStorageEventListener for storage event - * callbacks. + * @hide - Applications should use {@link android.os.storage.StorageEventListener} class for + * storage event callbacks. */ -oneway interface IMountServiceListener { +oneway interface IStorageEventListener { /** * Detection state of USB Mass Storage has changed * diff --git a/core/java/android/os/storage/IMountService.aidl b/core/java/android/os/storage/IStorageManager.aidl similarity index 90% rename from core/java/android/os/storage/IMountService.aidl rename to core/java/android/os/storage/IStorageManager.aidl index 390df99c73a9..98cbce6c175d 100644 --- a/core/java/android/os/storage/IMountService.aidl +++ b/core/java/android/os/storage/IStorageManager.aidl @@ -19,8 +19,8 @@ package android.os.storage; import android.content.pm.IPackageMoveObserver; import android.os.ParcelFileDescriptor; import android.os.storage.DiskInfo; -import android.os.storage.IMountServiceListener; -import android.os.storage.IMountShutdownObserver; +import android.os.storage.IStorageEventListener; +import android.os.storage.IStorageShutdownObserver; import android.os.storage.IObbActionListener; import android.os.storage.StorageVolume; import android.os.storage.VolumeInfo; @@ -34,15 +34,15 @@ import android.os.storage.VolumeRecord; * @hide - Applications should use android.os.storage.StorageManager to access * storage functions. */ -interface IMountService { +interface IStorageManager { /** - * Registers an IMountServiceListener for receiving async notifications. + * Registers an IStorageEventListener for receiving async notifications. */ - void registerListener(IMountServiceListener listener) = 0; + void registerListener(IStorageEventListener listener) = 0; /** - * Unregisters an IMountServiceListener + * Unregisters an IStorageEventListener */ - void unregisterListener(IMountServiceListener listener) = 1; + void unregisterListener(IStorageEventListener listener) = 1; /** * Returns true if a USB mass storage host is connected */ @@ -58,7 +58,7 @@ interface IMountService { boolean isUsbMassStorageEnabled() = 4; /** * Mount external storage at given mount point. Returns an int consistent - * with MountServiceResultCode + * with StorageResultCode */ int mountVolume(in String mountPoint) = 5; /** @@ -74,7 +74,7 @@ interface IMountService { void unmountVolume(in String mountPoint, boolean force, boolean removeEncryption) = 6; /** * Format external storage given a mount point. Returns an int consistent - * with MountServiceResultCode + * with StorageResultCode */ int formatVolume(in String mountPoint) = 7; /** @@ -87,30 +87,30 @@ interface IMountService { String getVolumeState(in String mountPoint) = 9; /* * Creates a secure container with the specified parameters. Returns an int - * consistent with MountServiceResultCode + * consistent with StorageResultCode */ int createSecureContainer(in String id, int sizeMb, in String fstype, in String key, int ownerUid, boolean external) = 10; /* * Finalize a container which has just been created and populated. After * finalization, the container is immutable. Returns an int consistent with - * MountServiceResultCode + * StorageResultCode */ int finalizeSecureContainer(in String id) = 11; /* * Destroy a secure container, and free up all resources associated with it. * NOTE: Ensure all references are released prior to deleting. Returns an - * int consistent with MountServiceResultCode + * int consistent with StorageResultCode */ int destroySecureContainer(in String id, boolean force) = 12; /* * Mount a secure container with the specified key and owner UID. Returns an - * int consistent with MountServiceResultCode + * int consistent with StorageResultCode */ int mountSecureContainer(in String id, in String key, int ownerUid, boolean readOnly) = 13; /* * Unount a secure container. Returns an int consistent with - * MountServiceResultCode + * StorageResultCode */ int unmountSecureContainer(in String id, boolean force) = 14; /* @@ -119,7 +119,7 @@ interface IMountService { boolean isSecureContainerMounted(in String id) = 15; /* * Rename an unmounted secure container. Returns an int consistent with - * MountServiceResultCode + * StorageResultCode */ int renameSecureContainer(in String oldId, in String newId) = 16; /* @@ -131,19 +131,19 @@ interface IMountService { */ String[] getSecureContainerList() = 18; /** - * Shuts down the MountService and gracefully unmounts all external media. + * Shuts down the StorageManagerService and gracefully unmounts all external media. * Invokes call back once the shutdown is complete. */ - void shutdown(IMountShutdownObserver observer) = 19; + void shutdown(IStorageShutdownObserver observer) = 19; /** - * Call into MountService by PackageManager to notify that its done + * Call into StorageManagerService by PackageManager to notify that its done * processing the media status update request. */ void finishMediaUpdate() = 20; /** * Mounts an Opaque Binary Blob (OBB) with the specified decryption key and * only allows the calling process's UID access to the contents. - * MountService will call back to the supplied IObbActionListener to inform + * StorageManagerService will call back to the supplied IObbActionListener to inform * it of the terminal state of the call. */ void mountObb(in String rawPath, in String canonicalPath, in String key, @@ -151,7 +151,7 @@ interface IMountService { /** * Unmounts an Opaque Binary Blob (OBB). When the force flag is specified, * any program using it will be forcibly killed to unmount the image. - * MountService will call back to the supplied IObbActionListener to inform + * StorageManagerService will call back to the supplied IObbActionListener to inform * it of the terminal state of the call. */ void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 22; @@ -209,7 +209,7 @@ interface IMountService { int verifyEncryptionPassword(in String password) = 32; /* * Fix permissions in a container which has just been created and populated. - * Returns an int consistent with MountServiceResultCode + * Returns an int consistent with StorageResultCode */ int fixPermissionsSecureContainer(in String id, int gid, in String filename) = 33; /** diff --git a/core/java/android/os/storage/IMountShutdownObserver.aidl b/core/java/android/os/storage/IStorageShutdownObserver.aidl similarity index 91% rename from core/java/android/os/storage/IMountShutdownObserver.aidl rename to core/java/android/os/storage/IStorageShutdownObserver.aidl index f3e1654c4128..b28421791c64 100644 --- a/core/java/android/os/storage/IMountShutdownObserver.aidl +++ b/core/java/android/os/storage/IStorageShutdownObserver.aidl @@ -24,9 +24,9 @@ package android.os.storage; * * @hide - For internal consumption only. */ -interface IMountShutdownObserver { +interface IStorageShutdownObserver { /** - * This method is called when the shutdown of MountService completed. + * This method is called when the shutdown of StorageManagerService completed. * * @param statusCode indicates success or failure of the shutdown. */ diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index 1942fdee23dc..0472e02d8886 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -152,7 +152,7 @@ public class StorageManager { /** @hide Underlying data is corrupt */ public static final int ENCRYPTION_STATE_ERROR_CORRUPT = -4; - private static volatile IMountService sMountService = null; + private static volatile IStorageManager sStorageManager = null; // TODO: the location of the primary storage block varies from device to device, so we need to // try the most likely candidates - a long-term solution would be a device-specific vold @@ -166,13 +166,13 @@ public class StorageManager { private final Context mContext; private final ContentResolver mResolver; - private final IMountService mMountService; + private final IStorageManager mStorageManager; private final Looper mLooper; private final AtomicInteger mNextNonce = new AtomicInteger(0); private final ArrayList<StorageEventListenerDelegate> mDelegates = new ArrayList<>(); - private static class StorageEventListenerDelegate extends IMountServiceListener.Stub implements + private static class StorageEventListenerDelegate extends IStorageEventListener.Stub implements Handler.Callback { private static final int MSG_STORAGE_STATE_CHANGED = 1; private static final int MSG_VOLUME_STATE_CHANGED = 2; @@ -374,7 +374,7 @@ public class StorageManager { mContext = context; mResolver = context.getContentResolver(); mLooper = looper; - mMountService = IMountService.Stub.asInterface(ServiceManager.getServiceOrThrow("mount")); + mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getServiceOrThrow("mount")); } /** @@ -389,7 +389,7 @@ public class StorageManager { final StorageEventListenerDelegate delegate = new StorageEventListenerDelegate(listener, mLooper); try { - mMountService.registerListener(delegate); + mStorageManager.registerListener(delegate); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -410,7 +410,7 @@ public class StorageManager { final StorageEventListenerDelegate delegate = i.next(); if (delegate.mCallback == listener) { try { - mMountService.unregisterListener(delegate); + mStorageManager.unregisterListener(delegate); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -488,7 +488,7 @@ public class StorageManager { try { final String canonicalPath = new File(rawPath).getCanonicalPath(); final int nonce = mObbActionListener.addListener(listener); - mMountService.mountObb(rawPath, canonicalPath, key, mObbActionListener, nonce); + mStorageManager.mountObb(rawPath, canonicalPath, key, mObbActionListener, nonce); return true; } catch (IOException e) { throw new IllegalArgumentException("Failed to resolve path: " + rawPath, e); @@ -523,7 +523,7 @@ public class StorageManager { try { final int nonce = mObbActionListener.addListener(listener); - mMountService.unmountObb(rawPath, force, mObbActionListener, nonce); + mStorageManager.unmountObb(rawPath, force, mObbActionListener, nonce); return true; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); @@ -540,7 +540,7 @@ public class StorageManager { Preconditions.checkNotNull(rawPath, "rawPath cannot be null"); try { - return mMountService.isObbMounted(rawPath); + return mStorageManager.isObbMounted(rawPath); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -559,7 +559,7 @@ public class StorageManager { Preconditions.checkNotNull(rawPath, "rawPath cannot be null"); try { - return mMountService.getMountedObbPath(rawPath); + return mStorageManager.getMountedObbPath(rawPath); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -568,7 +568,7 @@ public class StorageManager { /** {@hide} */ public @NonNull List<DiskInfo> getDisks() { try { - return Arrays.asList(mMountService.getDisks()); + return Arrays.asList(mStorageManager.getDisks()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -654,7 +654,7 @@ public class StorageManager { /** {@hide} */ public @NonNull List<VolumeInfo> getVolumes() { try { - return Arrays.asList(mMountService.getVolumes(0)); + return Arrays.asList(mStorageManager.getVolumes(0)); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -664,7 +664,7 @@ public class StorageManager { public @NonNull List<VolumeInfo> getWritablePrivateVolumes() { try { final ArrayList<VolumeInfo> res = new ArrayList<>(); - for (VolumeInfo vol : mMountService.getVolumes(0)) { + for (VolumeInfo vol : mStorageManager.getVolumes(0)) { if (vol.getType() == VolumeInfo.TYPE_PRIVATE && vol.isMountedWritable()) { res.add(vol); } @@ -678,7 +678,7 @@ public class StorageManager { /** {@hide} */ public @NonNull List<VolumeRecord> getVolumeRecords() { try { - return Arrays.asList(mMountService.getVolumeRecords(0)); + return Arrays.asList(mStorageManager.getVolumeRecords(0)); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -721,7 +721,7 @@ public class StorageManager { /** {@hide} */ public void mount(String volId) { try { - mMountService.mount(volId); + mStorageManager.mount(volId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -730,7 +730,7 @@ public class StorageManager { /** {@hide} */ public void unmount(String volId) { try { - mMountService.unmount(volId); + mStorageManager.unmount(volId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -739,7 +739,7 @@ public class StorageManager { /** {@hide} */ public void format(String volId) { try { - mMountService.format(volId); + mStorageManager.format(volId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -748,7 +748,7 @@ public class StorageManager { /** {@hide} */ public long benchmark(String volId) { try { - return mMountService.benchmark(volId); + return mStorageManager.benchmark(volId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -757,7 +757,7 @@ public class StorageManager { /** {@hide} */ public void partitionPublic(String diskId) { try { - mMountService.partitionPublic(diskId); + mStorageManager.partitionPublic(diskId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -766,7 +766,7 @@ public class StorageManager { /** {@hide} */ public void partitionPrivate(String diskId) { try { - mMountService.partitionPrivate(diskId); + mStorageManager.partitionPrivate(diskId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -775,7 +775,7 @@ public class StorageManager { /** {@hide} */ public void partitionMixed(String diskId, int ratio) { try { - mMountService.partitionMixed(diskId, ratio); + mStorageManager.partitionMixed(diskId, ratio); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -795,7 +795,7 @@ public class StorageManager { try { // TODO: switch to explicit wipe command when we have it, // for now rely on the fact that vfat format does a wipe - mMountService.partitionPublic(diskId); + mStorageManager.partitionPublic(diskId); } catch (Exception e) { Slog.w(TAG, "Failed to wipe " + diskId + ", but soldiering onward", e); } @@ -808,7 +808,7 @@ public class StorageManager { /** {@hide} */ public void setVolumeNickname(String fsUuid, String nickname) { try { - mMountService.setVolumeNickname(fsUuid, nickname); + mStorageManager.setVolumeNickname(fsUuid, nickname); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -817,7 +817,7 @@ public class StorageManager { /** {@hide} */ public void setVolumeInited(String fsUuid, boolean inited) { try { - mMountService.setVolumeUserFlags(fsUuid, inited ? VolumeRecord.USER_FLAG_INITED : 0, + mStorageManager.setVolumeUserFlags(fsUuid, inited ? VolumeRecord.USER_FLAG_INITED : 0, VolumeRecord.USER_FLAG_INITED); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); @@ -827,7 +827,7 @@ public class StorageManager { /** {@hide} */ public void setVolumeSnoozed(String fsUuid, boolean snoozed) { try { - mMountService.setVolumeUserFlags(fsUuid, snoozed ? VolumeRecord.USER_FLAG_SNOOZED : 0, + mStorageManager.setVolumeUserFlags(fsUuid, snoozed ? VolumeRecord.USER_FLAG_SNOOZED : 0, VolumeRecord.USER_FLAG_SNOOZED); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); @@ -837,7 +837,7 @@ public class StorageManager { /** {@hide} */ public void forgetVolume(String fsUuid) { try { - mMountService.forgetVolume(fsUuid); + mStorageManager.forgetVolume(fsUuid); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -851,7 +851,7 @@ public class StorageManager { */ public String getPrimaryStorageUuid() { try { - return mMountService.getPrimaryStorageUuid(); + return mStorageManager.getPrimaryStorageUuid(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -865,7 +865,7 @@ public class StorageManager { */ public void setPrimaryStorageUuid(String volumeUuid, IPackageMoveObserver callback) { try { - mMountService.setPrimaryStorageUuid(volumeUuid, callback); + mStorageManager.setPrimaryStorageUuid(volumeUuid, callback); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -982,7 +982,7 @@ public class StorageManager { /** {@hide} */ public static @NonNull StorageVolume[] getVolumeList(int userId, int flags) { - final IMountService mountService = IMountService.Stub.asInterface( + final IStorageManager storageManager = IStorageManager.Stub.asInterface( ServiceManager.getService("mount")); try { String packageName = ActivityThread.currentOpPackageName(); @@ -1003,7 +1003,7 @@ public class StorageManager { if (uid <= 0) { return new StorageVolume[0]; } - return mountService.getVolumeList(uid, packageName, flags); + return storageManager.getVolumeList(uid, packageName, flags); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1085,7 +1085,7 @@ public class StorageManager { /** {@hide} */ public void createUserKey(int userId, int serialNumber, boolean ephemeral) { try { - mMountService.createUserKey(userId, serialNumber, ephemeral); + mStorageManager.createUserKey(userId, serialNumber, ephemeral); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1094,7 +1094,7 @@ public class StorageManager { /** {@hide} */ public void destroyUserKey(int userId) { try { - mMountService.destroyUserKey(userId); + mStorageManager.destroyUserKey(userId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1103,7 +1103,7 @@ public class StorageManager { /** {@hide} */ public void unlockUserKey(int userId, int serialNumber, byte[] token, byte[] secret) { try { - mMountService.unlockUserKey(userId, serialNumber, token, secret); + mStorageManager.unlockUserKey(userId, serialNumber, token, secret); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1112,7 +1112,7 @@ public class StorageManager { /** {@hide} */ public void lockUserKey(int userId) { try { - mMountService.lockUserKey(userId); + mStorageManager.lockUserKey(userId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1121,7 +1121,7 @@ public class StorageManager { /** {@hide} */ public void prepareUserStorage(String volumeUuid, int userId, int serialNumber, int flags) { try { - mMountService.prepareUserStorage(volumeUuid, userId, serialNumber, flags); + mStorageManager.prepareUserStorage(volumeUuid, userId, serialNumber, flags); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1130,7 +1130,7 @@ public class StorageManager { /** {@hide} */ public void destroyUserStorage(String volumeUuid, int userId, int flags) { try { - mMountService.destroyUserStorage(volumeUuid, userId, flags); + mStorageManager.destroyUserStorage(volumeUuid, userId, flags); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1138,17 +1138,17 @@ public class StorageManager { /** {@hide} */ public static boolean isUserKeyUnlocked(int userId) { - if (sMountService == null) { - sMountService = IMountService.Stub + if (sStorageManager == null) { + sStorageManager = IStorageManager.Stub .asInterface(ServiceManager.getService("mount")); } - if (sMountService == null) { + if (sStorageManager == null) { Slog.w(TAG, "Early during boot, assuming locked"); return false; } final long token = Binder.clearCallingIdentity(); try { - return sMountService.isUserKeyUnlocked(userId); + return sStorageManager.isUserKeyUnlocked(userId); } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } finally { @@ -1224,9 +1224,9 @@ public class StorageManager { } try { - IMountService mountService = IMountService.Stub.asInterface( + IStorageManager storageManager = IStorageManager.Stub.asInterface( ServiceManager.getService("mount")); - return mountService.getPasswordType() != CRYPT_TYPE_DEFAULT; + return storageManager.getPasswordType() != CRYPT_TYPE_DEFAULT; } catch (RemoteException e) { Log.e(TAG, "Error getting encryption type"); return false; @@ -1280,10 +1280,10 @@ public class StorageManager { /** {@hide} */ public static File maybeTranslateEmulatedPathToInternal(File path) { - final IMountService mountService = IMountService.Stub.asInterface( + final IStorageManager storageManager = IStorageManager.Stub.asInterface( ServiceManager.getService("mount")); try { - final VolumeInfo[] vols = mountService.getVolumes(0); + final VolumeInfo[] vols = storageManager.getVolumes(0); for (VolumeInfo vol : vols) { if ((vol.getType() == VolumeInfo.TYPE_EMULATED || vol.getType() == VolumeInfo.TYPE_PUBLIC) && vol.isMountedReadable()) { @@ -1303,7 +1303,7 @@ public class StorageManager { /** {@hide} */ public ParcelFileDescriptor mountAppFuse(String name) { try { - return mMountService.mountAppFuse(name); + return mStorageManager.mountAppFuse(name); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -1319,7 +1319,7 @@ public class StorageManager { /** @hide */ public static final int CRYPT_TYPE_PIN = 3; - // Constants for the data available via MountService.getField. + // Constants for the data available via StorageManagerService.getField. /** @hide */ public static final String SYSTEM_LOCALE_KEY = "SystemLocale"; /** @hide */ diff --git a/core/java/android/os/storage/MountServiceInternal.java b/core/java/android/os/storage/StorageManagerInternal.java similarity index 98% rename from core/java/android/os/storage/MountServiceInternal.java rename to core/java/android/os/storage/StorageManagerInternal.java index 17aaef98c769..d102b194f86d 100644 --- a/core/java/android/os/storage/MountServiceInternal.java +++ b/core/java/android/os/storage/StorageManagerInternal.java @@ -21,7 +21,7 @@ package android.os.storage; * * @hide Only for use within the system server. */ -public abstract class MountServiceInternal { +public abstract class StorageManagerInternal { /** * Policy that influences how external storage is mounted and reported. diff --git a/core/java/android/os/storage/StorageResultCode.java b/core/java/android/os/storage/StorageResultCode.java index 8e7db31ef2f5..c8438870585a 100644 --- a/core/java/android/os/storage/StorageResultCode.java +++ b/core/java/android/os/storage/StorageResultCode.java @@ -18,7 +18,7 @@ package android.os.storage; /** * Class that provides access to constants returned from StorageManager - * and lower level MountService APIs. + * and lower level StorageManagerService APIs. * * @hide */ diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 79b42ba4c675..afbc09bba891 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -5854,7 +5854,8 @@ public final class Settings { "search_per_source_concurrent_query_limit"; /** - * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true) + * Whether or not alert sounds are played on StorageManagerService events. + * (0 = false, 1 = true) * @hide */ public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd"; diff --git a/core/java/com/android/internal/content/PackageHelper.java b/core/java/com/android/internal/content/PackageHelper.java index 4e3c3fc94a43..a3134b3bc29b 100644 --- a/core/java/com/android/internal/content/PackageHelper.java +++ b/core/java/com/android/internal/content/PackageHelper.java @@ -29,7 +29,7 @@ import android.os.FileUtils; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.os.storage.StorageResultCode; import android.os.storage.StorageVolume; @@ -53,7 +53,7 @@ import java.util.zip.ZipOutputStream; /** * Constants used internally between the PackageManager * and media container service transports. - * Some utility methods to invoke MountService api. + * Some utility methods to invoke StorageManagerService api. */ public class PackageHelper { public static final int RECOMMEND_INSTALL_INTERNAL = 1; @@ -74,13 +74,13 @@ public class PackageHelper { public static final int APP_INSTALL_INTERNAL = 1; public static final int APP_INSTALL_EXTERNAL = 2; - public static IMountService getMountService() throws RemoteException { + public static IStorageManager getStorageManager() throws RemoteException { IBinder service = ServiceManager.getService("mount"); if (service != null) { - return IMountService.Stub.asInterface(service); + return IStorageManager.Stub.asInterface(service); } else { - Log.e(TAG, "Can't get mount service"); - throw new RemoteException("Could not contact mount service"); + Log.e(TAG, "Can't get storagemanager service"); + throw new RemoteException("Could not contact storagemanager service"); } } @@ -89,23 +89,23 @@ public class PackageHelper { // Round up to nearest MB, plus another MB for filesystem overhead final int sizeMb = (int) ((sizeBytes + MB_IN_BYTES) / MB_IN_BYTES) + 1; try { - IMountService mountService = getMountService(); + IStorageManager storageManager = getStorageManager(); if (localLOGV) Log.i(TAG, "Size of container " + sizeMb + " MB"); - int rc = mountService.createSecureContainer(cid, sizeMb, "ext4", sdEncKey, uid, + int rc = storageManager.createSecureContainer(cid, sizeMb, "ext4", sdEncKey, uid, isExternal); if (rc != StorageResultCode.OperationSucceeded) { Log.e(TAG, "Failed to create secure container " + cid); return null; } - String cachePath = mountService.getSecureContainerPath(cid); + String cachePath = storageManager.getSecureContainerPath(cid); if (localLOGV) Log.i(TAG, "Created secure container " + cid + " at " + cachePath); return cachePath; } catch (RemoteException e) { - Log.e(TAG, "MountService running?"); + Log.e(TAG, "StorageManagerService running?"); } return null; } @@ -114,13 +114,13 @@ public class PackageHelper { // Round up to nearest MB, plus another MB for filesystem overhead final int sizeMb = (int) ((sizeBytes + MB_IN_BYTES) / MB_IN_BYTES) + 1; try { - IMountService mountService = getMountService(); - int rc = mountService.resizeSecureContainer(cid, sizeMb, sdEncKey); + IStorageManager storageManager = getStorageManager(); + int rc = storageManager.resizeSecureContainer(cid, sizeMb, sdEncKey); if (rc == StorageResultCode.OperationSucceeded) { return true; } } catch (RemoteException e) { - Log.e(TAG, "MountService running?"); + Log.e(TAG, "StorageManagerService running?"); } Log.e(TAG, "Failed to create secure container " + cid); return false; @@ -132,35 +132,35 @@ public class PackageHelper { public static String mountSdDir(String cid, String key, int ownerUid, boolean readOnly) { try { - int rc = getMountService().mountSecureContainer(cid, key, ownerUid, readOnly); + int rc = getStorageManager().mountSecureContainer(cid, key, ownerUid, readOnly); if (rc != StorageResultCode.OperationSucceeded) { Log.i(TAG, "Failed to mount container " + cid + " rc : " + rc); return null; } - return getMountService().getSecureContainerPath(cid); + return getStorageManager().getSecureContainerPath(cid); } catch (RemoteException e) { - Log.e(TAG, "MountService running?"); + Log.e(TAG, "StorageManagerService running?"); } return null; } public static boolean unMountSdDir(String cid) { try { - int rc = getMountService().unmountSecureContainer(cid, true); + int rc = getStorageManager().unmountSecureContainer(cid, true); if (rc != StorageResultCode.OperationSucceeded) { Log.e(TAG, "Failed to unmount " + cid + " with rc " + rc); return false; } return true; } catch (RemoteException e) { - Log.e(TAG, "MountService running?"); + Log.e(TAG, "StorageManagerService running?"); } return false; } public static boolean renameSdDir(String oldId, String newId) { try { - int rc = getMountService().renameSecureContainer(oldId, newId); + int rc = getStorageManager().renameSecureContainer(oldId, newId); if (rc != StorageResultCode.OperationSucceeded) { Log.e(TAG, "Failed to rename " + oldId + " to " + newId + "with rc " + rc); @@ -176,7 +176,7 @@ public class PackageHelper { public static String getSdDir(String cid) { try { - return getMountService().getSecureContainerPath(cid); + return getStorageManager().getSecureContainerPath(cid); } catch (RemoteException e) { Log.e(TAG, "Failed to get container path for " + cid + " with exception " + e); @@ -186,7 +186,7 @@ public class PackageHelper { public static String getSdFilesystem(String cid) { try { - return getMountService().getSecureContainerFilesystemPath(cid); + return getStorageManager().getSecureContainerFilesystemPath(cid); } catch (RemoteException e) { Log.e(TAG, "Failed to get container path for " + cid + " with exception " + e); @@ -196,7 +196,7 @@ public class PackageHelper { public static boolean finalizeSdDir(String cid) { try { - int rc = getMountService().finalizeSecureContainer(cid); + int rc = getStorageManager().finalizeSecureContainer(cid); if (rc != StorageResultCode.OperationSucceeded) { Log.i(TAG, "Failed to finalize container " + cid); return false; @@ -212,7 +212,7 @@ public class PackageHelper { public static boolean destroySdDir(String cid) { try { if (localLOGV) Log.i(TAG, "Forcibly destroying container " + cid); - int rc = getMountService().destroySecureContainer(cid, true); + int rc = getStorageManager().destroySecureContainer(cid, true); if (rc != StorageResultCode.OperationSucceeded) { Log.i(TAG, "Failed to destroy container " + cid); return false; @@ -227,7 +227,7 @@ public class PackageHelper { public static String[] getSecureContainerList() { try { - return getMountService().getSecureContainerList(); + return getStorageManager().getSecureContainerList(); } catch (RemoteException e) { Log.e(TAG, "Failed to get secure container list with exception" + e); @@ -237,7 +237,7 @@ public class PackageHelper { public static boolean isContainerMounted(String cid) { try { - return getMountService().isSecureContainerMounted(cid); + return getStorageManager().isSecureContainerMounted(cid); } catch (RemoteException e) { Log.e(TAG, "Failed to find out if container " + cid + " mounted"); } @@ -325,7 +325,7 @@ public class PackageHelper { public static boolean fixSdPermissions(String cid, int gid, String filename) { try { - int rc = getMountService().fixPermissionsSecureContainer(cid, gid, filename); + int rc = getStorageManager().fixPermissionsSecureContainer(cid, gid, filename); if (rc != StorageResultCode.OperationSucceeded) { Log.i(TAG, "Failed to fixperms container " + cid); return false; diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 71252fb06f2f..b0bc81bd1af1 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -36,7 +36,7 @@ import android.os.ServiceManager; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.provider.Settings; import android.text.TextUtils; @@ -682,10 +682,10 @@ public class LockPatternUtils { return; } - IMountService mountService = IMountService.Stub.asInterface(service); + IStorageManager storageManager = IStorageManager.Stub.asInterface(service); try { Log.d(TAG, "Setting owner info"); - mountService.setField(StorageManager.OWNER_INFO_KEY, ownerInfo); + storageManager.setField(StorageManager.OWNER_INFO_KEY, ownerInfo); } catch (RemoteException e) { Log.e(TAG, "Error changing user info", e); } @@ -746,9 +746,9 @@ public class LockPatternUtils { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... dummy) { - IMountService mountService = IMountService.Stub.asInterface(service); + IStorageManager storageManager = IStorageManager.Stub.asInterface(service); try { - mountService.changeEncryptionPassword(type, password); + storageManager.changeEncryptionPassword(type, password); } catch (RemoteException e) { Log.e(TAG, "Error changing encryption password", e); } @@ -1122,9 +1122,9 @@ public class LockPatternUtils { return; } - IMountService mountService = IMountService.Stub.asInterface(service); + IStorageManager storageManager = IStorageManager.Stub.asInterface(service); try { - mountService.setField(StorageManager.PATTERN_VISIBLE_KEY, enabled ? "1" : "0"); + storageManager.setField(StorageManager.PATTERN_VISIBLE_KEY, enabled ? "1" : "0"); } catch (RemoteException e) { Log.e(TAG, "Error changing pattern visible state", e); } @@ -1145,9 +1145,9 @@ public class LockPatternUtils { return; } - IMountService mountService = IMountService.Stub.asInterface(service); + IStorageManager storageManager = IStorageManager.Stub.asInterface(service); try { - mountService.setField(StorageManager.PASSWORD_VISIBLE_KEY, enabled ? "1" : "0"); + storageManager.setField(StorageManager.PASSWORD_VISIBLE_KEY, enabled ? "1" : "0"); } catch (RemoteException e) { Log.e(TAG, "Error changing password visible state", e); } diff --git a/core/tests/coretests/src/android/content/pm/PackageHelperTests.java b/core/tests/coretests/src/android/content/pm/PackageHelperTests.java index 06c495e66b6a..5af2667d29ff 100644 --- a/core/tests/coretests/src/android/content/pm/PackageHelperTests.java +++ b/core/tests/coretests/src/android/content/pm/PackageHelperTests.java @@ -21,7 +21,7 @@ import static android.net.TrafficStats.MB_IN_BYTES; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.test.AndroidTestCase; import android.util.Log; @@ -31,14 +31,14 @@ public class PackageHelperTests extends AndroidTestCase { private static final boolean localLOGV = true; public static final String TAG = "PackageHelperTests"; protected final String PREFIX = "android.content.pm"; - private IMountService mMs; + private IStorageManager mSm; private String fullId; private String fullId2; - private IMountService getMs() { + private IStorageManager getSm() { IBinder service = ServiceManager.getService("mount"); if (service != null) { - return IMountService.Stub.asInterface(service); + return IStorageManager.Stub.asInterface(service); } else { Log.e(TAG, "Can't get mount service"); } @@ -47,12 +47,12 @@ public class PackageHelperTests extends AndroidTestCase { private void cleanupContainers() throws RemoteException { Log.d(TAG,"cleanUp"); - IMountService ms = getMs(); - String[] containers = ms.getSecureContainerList(); + IStorageManager sm = getSm(); + String[] containers = sm.getSecureContainerList(); for (int i = 0; i < containers.length; i++) { if (containers[i].startsWith(PREFIX)) { Log.d(TAG,"cleaing up "+containers[i]); - ms.destroySecureContainer(containers[i], true); + sm.destroySecureContainer(containers[i], true); } } } diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java index b5f06178aa3c..a15cba07e7bb 100644 --- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java +++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java @@ -46,7 +46,7 @@ import android.os.ServiceManager; import android.os.StatFs; import android.os.SystemClock; import android.os.UserManager; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.os.storage.StorageListener; import android.os.storage.StorageManager; import android.os.storage.StorageResultCode; @@ -1149,12 +1149,12 @@ public class PackageManagerTests extends AndroidTestCase { } } - IMountService getMs() { + IStorageManager getSm() { IBinder service = ServiceManager.getService("mount"); if (service != null) { - return IMountService.Stub.asInterface(service); + return IStorageManager.Stub.asInterface(service); } else { - Log.e(TAG, "Can't get mount service"); + Log.e(TAG, "Can't get storagemanager service"); } return null; } @@ -1185,7 +1185,7 @@ public class PackageManagerTests extends AndroidTestCase { try { // Wait on observer synchronized (observer) { - int ret = getMs().mountVolume(path); + int ret = getSm().mountVolume(path); if (ret != StorageResultCode.OperationSucceeded) { throw new Exception("Could not mount the media"); } @@ -1224,7 +1224,7 @@ public class PackageManagerTests extends AndroidTestCase { try { // Wait on observer synchronized (observer) { - getMs().unmountVolume(path, true, false); + getSm().unmountVolume(path, true, false); long waitTime = 0; while ((!observer.isDone()) && (waitTime < MAX_WAIT_TIME)) { observer.wait(WAIT_TIME_INCR); @@ -2754,7 +2754,7 @@ public class PackageManagerTests extends AndroidTestCase { } } - /* This test creates a stale container via MountService and then installs + /* This test creates a stale container via StorageManagerService and then installs * a package and verifies that the stale container is cleaned up and install * is successful. * Please note that this test is very closely tied to the framework's diff --git a/core/tests/coretests/src/android/os/storage/AsecTests.java b/core/tests/coretests/src/android/os/storage/AsecTests.java index 4f724fe5288b..e9a810d8e843 100644 --- a/core/tests/coretests/src/android/os/storage/AsecTests.java +++ b/core/tests/coretests/src/android/os/storage/AsecTests.java @@ -50,21 +50,21 @@ public class AsecTests extends AndroidTestCase { } private void cleanupContainers() throws RemoteException { - IMountService ms = getMs(); - String[] containers = ms.getSecureContainerList(); + IStorageManager sm = getSm(); + String[] containers = sm.getSecureContainerList(); for (int i = 0; i < containers.length; i++) { if (containers[i].startsWith(SECURE_CONTAINER_PREFIX)) { if (localLOGV) Log.i(TAG, "Cleaning: " + containers[i]); - ms.destroySecureContainer(containers[i], true); + sm.destroySecureContainer(containers[i], true); } } } private boolean containerExists(String localId) throws RemoteException { - IMountService ms = getMs(); - String[] containers = ms.getSecureContainerList(); + IStorageManager sm = getSm(); + String[] containers = sm.getSecureContainerList(); String fullId = SECURE_CONTAINER_PREFIX + localId; for (int i = 0; i < containers.length; i++) { @@ -80,8 +80,8 @@ public class AsecTests extends AndroidTestCase { assertTrue("Media should be mounted", isMediaMounted()); String fullId = SECURE_CONTAINER_PREFIX + localId; - IMountService ms = getMs(); - return ms.createSecureContainer(fullId, size, filesystem, key, android.os.Process.myUid(), + IStorageManager sm = getSm(); + return sm.createSecureContainer(fullId, size, filesystem, key, android.os.Process.myUid(), isExternal); } @@ -89,8 +89,8 @@ public class AsecTests extends AndroidTestCase { assertTrue("Media should be mounted", isMediaMounted()); String fullId = SECURE_CONTAINER_PREFIX + localId; - IMountService ms = getMs(); - return ms.mountSecureContainer(fullId, key, android.os.Process.myUid(), true); + IStorageManager sm = getSm(); + return sm.mountSecureContainer(fullId, key, android.os.Process.myUid(), true); } private int renameContainer(String localId1, String localId2) throws Exception { @@ -98,47 +98,47 @@ public class AsecTests extends AndroidTestCase { String fullId1 = SECURE_CONTAINER_PREFIX + localId1; String fullId2 = SECURE_CONTAINER_PREFIX + localId2; - IMountService ms = getMs(); - return ms.renameSecureContainer(fullId1, fullId2); + IStorageManager sm = getSm(); + return sm.renameSecureContainer(fullId1, fullId2); } private int unmountContainer(String localId, boolean force) throws Exception { assertTrue("Media should be mounted", isMediaMounted()); String fullId = SECURE_CONTAINER_PREFIX + localId; - IMountService ms = getMs(); - return ms.unmountSecureContainer(fullId, force); + IStorageManager sm = getSm(); + return sm.unmountSecureContainer(fullId, force); } private int destroyContainer(String localId, boolean force) throws Exception { assertTrue("Media should be mounted", isMediaMounted()); String fullId = SECURE_CONTAINER_PREFIX + localId; - IMountService ms = getMs(); - return ms.destroySecureContainer(fullId, force); + IStorageManager sm = getSm(); + return sm.destroySecureContainer(fullId, force); } private boolean isContainerMounted(String localId) throws Exception { assertTrue("Media should be mounted", isMediaMounted()); String fullId = SECURE_CONTAINER_PREFIX + localId; - IMountService ms = getMs(); - return ms.isSecureContainerMounted(fullId); + IStorageManager sm = getSm(); + return sm.isSecureContainerMounted(fullId); } - private IMountService getMs() { + private IStorageManager getSm() { IBinder service = ServiceManager.getService("mount"); if (service != null) { - return IMountService.Stub.asInterface(service); + return IStorageManager.Stub.asInterface(service); } else { - Log.e(TAG, "Can't get mount service"); + Log.e(TAG, "Can't get storagemanager service"); } return null; } private boolean isMediaMounted() throws Exception { String mPath = Environment.getExternalStorageDirectory().toString(); - String state = getMs().getVolumeState(mPath); + String state = getSm().getVolumeState(mPath); return Environment.MEDIA_MOUNTED.equals(state); } @@ -385,11 +385,11 @@ public class AsecTests extends AndroidTestCase { return; } - IMountService ms = getMs(); + IStorageManager sm = getSm(); assertEquals(StorageResultCode.OperationSucceeded, createContainer("testUnmountBusyContainer", 4, "none", FS_FAT, true)); - String path = ms.getSecureContainerPath(SECURE_CONTAINER_PREFIX + String path = sm.getSecureContainerPath(SECURE_CONTAINER_PREFIX + "testUnmountBusyContainer"); File f = new File(path, "reference"); @@ -408,12 +408,12 @@ public class AsecTests extends AndroidTestCase { return; } - IMountService ms = getMs(); + IStorageManager sm = getSm(); assertEquals(StorageResultCode.OperationSucceeded, createContainer("testDestroyBusyContainer", 4, "none", FS_FAT, true)); - String path = ms.getSecureContainerPath(SECURE_CONTAINER_PREFIX + String path = sm.getSecureContainerPath(SECURE_CONTAINER_PREFIX + "testDestroyBusyContainer"); File f = new File(path, "reference"); @@ -480,10 +480,10 @@ public class AsecTests extends AndroidTestCase { return; } - IMountService ms = getMs(); + IStorageManager sm = getSm(); assertEquals(StorageResultCode.OperationSucceeded, createContainer("testContainerSize", 1, "none", FS_FAT, true)); - String path = ms.getSecureContainerPath(SECURE_CONTAINER_PREFIX + "testContainerSize"); + String path = sm.getSecureContainerPath(SECURE_CONTAINER_PREFIX + "testContainerSize"); byte[] buf = new byte[4096]; File f = new File(path, "reference"); @@ -495,9 +495,9 @@ public class AsecTests extends AndroidTestCase { } public void testGetSecureContainerPath_NonExistPath_Failure() throws Exception { - IMountService ms = getMs(); + IStorageManager sm = getSm(); assertNull("Getting the path for an invalid container should return null", - ms.getSecureContainerPath("jparks.broke.it")); + sm.getSecureContainerPath("jparks.broke.it")); } /*------------ Tests for unmounting volume ---*/ @@ -506,7 +506,7 @@ public class AsecTests extends AndroidTestCase { boolean getMediaState() throws Exception { String mPath = Environment.getExternalStorageDirectory().toString(); - String state = getMs().getVolumeState(mPath); + String state = getSm().getVolumeState(mPath); return Environment.MEDIA_MOUNTED.equals(state); } @@ -520,7 +520,7 @@ public class AsecTests extends AndroidTestCase { } String mPath = Environment.getExternalStorageDirectory().toString(); - int ret = getMs().mountVolume(mPath); + int ret = getSm().mountVolume(mPath); return ret == StorageResultCode.OperationSucceeded; } @@ -567,7 +567,7 @@ public class AsecTests extends AndroidTestCase { try { // Wait on observer synchronized(observer) { - getMs().unmountVolume(path, false, false); + getSm().unmountVolume(path, false, false); long waitTime = 0; while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) { observer.wait(WAIT_TIME_INCR); @@ -634,7 +634,7 @@ public class AsecTests extends AndroidTestCase { // Wait on observer synchronized(observer) { for (int i = 0; i < 5; i++) { - getMs().unmountVolume(path, false, false); + getSm().unmountVolume(path, false, false); } long waitTime = 0; while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) { @@ -661,7 +661,7 @@ public class AsecTests extends AndroidTestCase { } } - class ShutdownObserver extends IMountShutdownObserver.Stub{ + class ShutdownObserver extends IStorageShutdownObserver.Stub{ private boolean doneFlag = false; int statusCode; @@ -683,10 +683,10 @@ public class AsecTests extends AndroidTestCase { } void invokeShutdown() throws Exception { - IMountService ms = getMs(); + IStorageManager sm = getSm(); ShutdownObserver observer = new ShutdownObserver(); synchronized (observer) { - ms.shutdown(observer); + sm.shutdown(observer); } } @@ -731,12 +731,12 @@ public class AsecTests extends AndroidTestCase { if (!getMediaState()) { mountMedia(); } - IMountService ms = getMs(); + IStorageManager sm = getSm(); ShutdownObserver observer = new ShutdownObserver(); synchronized (observer) { - ms.shutdown(observer); + sm.shutdown(observer); for (int i = 0; i < 4; i++) { - ms.shutdown(null); + sm.shutdown(null); } } } finally { diff --git a/libs/storage/IMountService.cpp b/libs/storage/IMountService.cpp index fe1ee02420c2..fa3d8bd0930f 100644 --- a/libs/storage/IMountService.cpp +++ b/libs/storage/IMountService.cpp @@ -553,7 +553,7 @@ public: } }; -IMPLEMENT_META_INTERFACE(MountService, "android.os.storage.IMountService") +IMPLEMENT_META_INTERFACE(MountService, "android.os.storage.IStorageManager") // ---------------------------------------------------------------------- diff --git a/libs/storage/IMountServiceListener.cpp b/libs/storage/IMountServiceListener.cpp index 6a093fd94929..033d70d5694f 100644 --- a/libs/storage/IMountServiceListener.cpp +++ b/libs/storage/IMountServiceListener.cpp @@ -34,7 +34,7 @@ public: const String16& /* oldState */, const String16& /* newState */) { } }; -IMPLEMENT_META_INTERFACE(MountServiceListener, "android.os.storage.IMountServiceListener") +IMPLEMENT_META_INTERFACE(MountServiceListener, "android.os.storage.IStorageEventListener") // ---------------------------------------------------------------------- diff --git a/libs/storage/IMountShutdownObserver.cpp b/libs/storage/IMountShutdownObserver.cpp index 6114d4ac5978..e5de603cd5ee 100644 --- a/libs/storage/IMountShutdownObserver.cpp +++ b/libs/storage/IMountShutdownObserver.cpp @@ -31,7 +31,7 @@ public: virtual void onShutDownComplete(const int32_t /* statusCode */) {} }; -IMPLEMENT_META_INTERFACE(MountShutdownObserver, "android.os.storage.IMountShutdownObserver") +IMPLEMENT_META_INTERFACE(MountShutdownObserver, "android.os.storage.IStorageShutdownObserver") status_t BnMountShutdownObserver::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) diff --git a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java index bfc9ff30b5a3..7fa57367301e 100644 --- a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java +++ b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java @@ -27,7 +27,7 @@ import android.os.Handler; import android.os.Message; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.text.Editable; import android.text.TextWatcher; @@ -64,7 +64,7 @@ public class BackupRestoreConfirmation extends Activity { Handler mHandler; IBackupManager mBackupManager; - IMountService mMountService; + IStorageManager mStorageManager; FullObserver mObserver; int mToken; boolean mIsEncrypted; @@ -158,7 +158,7 @@ public class BackupRestoreConfirmation extends Activity { } mBackupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE)); - mMountService = IMountService.Stub.asInterface(ServiceManager.getService("mount")); + mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getService("mount")); mHandler = new ObserverHandler(getApplicationContext()); final Object oldObserver = getLastNonConfigurationInstance(); @@ -271,14 +271,14 @@ public class BackupRestoreConfirmation extends Activity { boolean deviceIsEncrypted() { try { - return mMountService.getEncryptionState() + return mStorageManager.getEncryptionState() != StorageManager.ENCRYPTION_STATE_NONE - && mMountService.getPasswordType() + && mStorageManager.getPasswordType() != StorageManager.CRYPT_TYPE_DEFAULT; } catch (Exception e) { - // If we can't talk to the mount service we have a serious problem; fail + // If we can't talk to the storagemanager service we have a serious problem; fail // "secure" i.e. assuming that the device is encrypted. - Slog.e(TAG, "Unable to communicate with mount service: " + e.getMessage()); + Slog.e(TAG, "Unable to communicate with storagemanager service: " + e.getMessage()); return true; } } diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index dd543a35a579..d784a3a5d731 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -645,7 +645,7 @@ class DatabaseHelper extends SQLiteOpenHelper { if (upgradeVersion == 45) { /* - * New settings for MountService + * New settings for StorageManagerService */ db.beginTransaction(); try { diff --git a/preloaded-classes b/preloaded-classes index 7aa029cd24cc..a79ae5098098 100644 --- a/preloaded-classes +++ b/preloaded-classes @@ -1726,9 +1726,9 @@ android.os.UserManager android.os.Vibrator android.os.ZygoteStartFailedEx android.os.health.SystemHealthManager -android.os.storage.IMountService -android.os.storage.IMountService$Stub -android.os.storage.IMountService$Stub$Proxy +android.os.storage.IStorageManager +android.os.storage.IStorageManager$Stub +android.os.storage.IStorageManager$Stub$Proxy android.os.storage.StorageManager android.os.storage.StorageVolume android.os.storage.StorageVolume$1 diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index 539f7481e942..8151c8aa1e88 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -80,7 +80,7 @@ import android.os.SystemClock; import android.os.UserHandle; import android.os.WorkSource; import android.os.Environment.UserEnvironment; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.provider.Settings; import android.system.ErrnoException; @@ -268,7 +268,7 @@ public class BackupManagerService { private IActivityManager mActivityManager; private PowerManager mPowerManager; private AlarmManager mAlarmManager; - private IMountService mMountService; + private IStorageManager mStorageManager; IBackupManager mBackupManagerBinder; boolean mEnabled; // access to this is synchronized on 'this' @@ -1079,7 +1079,7 @@ public class BackupManagerService { mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); - mMountService = IMountService.Stub.asInterface(ServiceManager.getService("mount")); + mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getService("mount")); mBackupManagerBinder = Trampoline.asInterface(parent.asBinder()); @@ -3982,14 +3982,14 @@ public class BackupManagerService { boolean deviceIsEncrypted() { try { - return mMountService.getEncryptionState() + return mStorageManager.getEncryptionState() != StorageManager.ENCRYPTION_STATE_NONE - && mMountService.getPasswordType() + && mStorageManager.getPasswordType() != StorageManager.CRYPT_TYPE_DEFAULT; } catch (Exception e) { - // If we can't talk to the mount service we have a serious problem; fail + // If we can't talk to the storagemanager service we have a serious problem; fail // "secure" i.e. assuming that the device is encrypted. - Slog.e(TAG, "Unable to communicate with mount service: " + e.getMessage()); + Slog.e(TAG, "Unable to communicate with storagemanager service: " + e.getMessage()); return true; } } diff --git a/services/core/java/com/android/server/AppOpsService.java b/services/core/java/com/android/server/AppOpsService.java index 7c2eea3f68aa..570843e3064b 100644 --- a/services/core/java/com/android/server/AppOpsService.java +++ b/services/core/java/com/android/server/AppOpsService.java @@ -54,7 +54,7 @@ import android.os.ServiceManager; import android.os.ShellCallback; import android.os.ShellCommand; import android.os.UserHandle; -import android.os.storage.MountServiceInternal; +import android.os.storage.StorageManagerInternal; import android.util.ArrayMap; import android.util.ArraySet; import android.util.AtomicFile; @@ -294,10 +294,10 @@ public class AppOpsService extends IAppOpsService.Stub { } } - MountServiceInternal mountServiceInternal = LocalServices.getService( - MountServiceInternal.class); - mountServiceInternal.addExternalStoragePolicy( - new MountServiceInternal.ExternalStorageMountPolicy() { + StorageManagerInternal storageManagerInternal = LocalServices.getService( + StorageManagerInternal.class); + storageManagerInternal.addExternalStoragePolicy( + new StorageManagerInternal.ExternalStorageMountPolicy() { @Override public int getMountMode(int uid, String packageName) { if (Process.isIsolated(uid)) { diff --git a/services/core/java/com/android/server/EventLogTags.logtags b/services/core/java/com/android/server/EventLogTags.logtags index 74ff41c13802..eb2cd0b3ae4b 100644 --- a/services/core/java/com/android/server/EventLogTags.logtags +++ b/services/core/java/com/android/server/EventLogTags.logtags @@ -248,7 +248,7 @@ option java_package com.android.server 51501 idle_maintenance_window_finish (time|2|3), (lastUserActivity|2|3), (batteryLevel|1|6), (batteryCharging|1|5) # --------------------------- -# MountService.java +# StorageManagerService.java # --------------------------- 2755 fstrim_start (time|2|3) 2756 fstrim_finish (time|2|3) diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java index 991ce4541910..67014314595f 100644 --- a/services/core/java/com/android/server/LockSettingsService.java +++ b/services/core/java/com/android/server/LockSettingsService.java @@ -51,7 +51,7 @@ import android.os.Process; import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ShellCallback; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.os.ServiceManager; import android.os.StrictMode; @@ -1160,10 +1160,10 @@ public class LockSettingsService extends ILockSettings.Stub { private void addUserKeyAuth(int userId, byte[] token, byte[] secret) throws RemoteException { final UserInfo userInfo = UserManager.get(mContext).getUserInfo(userId); - final IMountService mountService = getMountService(); + final IStorageManager storageManager = getStorageManager(); final long callingId = Binder.clearCallingIdentity(); try { - mountService.addUserKeyAuth(userId, userInfo.serialNumber, token, secret); + storageManager.addUserKeyAuth(userId, userInfo.serialNumber, token, secret); } finally { Binder.restoreCallingIdentity(callingId); } @@ -1171,10 +1171,10 @@ public class LockSettingsService extends ILockSettings.Stub { private void fixateNewestUserKeyAuth(int userId) throws RemoteException { - final IMountService mountService = getMountService(); + final IStorageManager storageManager = getStorageManager(); final long callingId = Binder.clearCallingIdentity(); try { - mountService.fixateNewestUserKeyAuth(userId); + storageManager.fixateNewestUserKeyAuth(userId); } finally { Binder.restoreCallingIdentity(callingId); } @@ -1488,7 +1488,7 @@ public class LockSettingsService extends ILockSettings.Stub { // we should, within the first minute of decrypting the phone if this // service can't connect to vold, it restarts, and then the new instance // does successfully connect. - final IMountService service = getMountService(); + final IStorageManager service = getStorageManager(); String password; long identity = Binder.clearCallingIdentity(); try { @@ -1651,10 +1651,10 @@ public class LockSettingsService extends ILockSettings.Stub { Secure.LOCK_SCREEN_OWNER_INFO }; - private IMountService getMountService() { + private IStorageManager getStorageManager() { final IBinder service = ServiceManager.getService("mount"); if (service != null) { - return IMountService.Stub.asInterface(service); + return IStorageManager.Stub.asInterface(service); } return null; } diff --git a/services/core/java/com/android/server/MountServiceIdler.java b/services/core/java/com/android/server/MountServiceIdler.java index 956568dbaaa2..d8bd0bb5a93c 100644 --- a/services/core/java/com/android/server/MountServiceIdler.java +++ b/services/core/java/com/android/server/MountServiceIdler.java @@ -67,7 +67,7 @@ public class MountServiceIdler extends JobService { // that lets us cleanly end our idle timeslice. It's safe to call // finishIdle() from any thread. mJobParams = params; - MountService ms = MountService.sSelf; + StorageManagerService ms = StorageManagerService.sSelf; if (ms != null) { synchronized (mFinishCallback) { mStarted = true; diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/StorageManagerService.java similarity index 98% rename from services/core/java/com/android/server/MountService.java rename to services/core/java/com/android/server/StorageManagerService.java index ee625d951b5e..11fabb4182ff 100644 --- a/services/core/java/com/android/server/MountService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -68,11 +68,11 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.os.storage.DiskInfo; -import android.os.storage.IMountService; -import android.os.storage.IMountServiceListener; -import android.os.storage.IMountShutdownObserver; +import android.os.storage.IStorageEventListener; +import android.os.storage.IStorageShutdownObserver; import android.os.storage.IObbActionListener; -import android.os.storage.MountServiceInternal; +import android.os.storage.IStorageManager; +import android.os.storage.StorageManagerInternal; import android.os.storage.OnObbStateChangeListener; import android.os.storage.StorageManager; import android.os.storage.StorageResultCode; @@ -149,14 +149,14 @@ import javax.crypto.spec.PBEKeySpec; * watch for and manage dynamically added storage, such as SD cards and USB mass * storage. Also decides how storage should be presented to users on the device. */ -class MountService extends IMountService.Stub +class StorageManagerService extends IStorageManager.Stub implements INativeDaemonConnectorCallbacks, Watchdog.Monitor { // Static direct instance pointer for the tightly-coupled idle service to use - static MountService sSelf = null; + static StorageManagerService sSelf = null; public static class Lifecycle extends SystemService { - private MountService mMountService; + private StorageManagerService mStorageManagerService; public Lifecycle(Context context) { super(context); @@ -164,33 +164,33 @@ class MountService extends IMountService.Stub @Override public void onStart() { - mMountService = new MountService(getContext()); - publishBinderService("mount", mMountService); - mMountService.start(); + mStorageManagerService = new StorageManagerService(getContext()); + publishBinderService("mount", mStorageManagerService); + mStorageManagerService.start(); } @Override public void onBootPhase(int phase) { if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) { - mMountService.systemReady(); + mStorageManagerService.systemReady(); } else if (phase == SystemService.PHASE_BOOT_COMPLETED) { - mMountService.bootCompleted(); + mStorageManagerService.bootCompleted(); } } @Override public void onSwitchUser(int userHandle) { - mMountService.mCurrentUserId = userHandle; + mStorageManagerService.mCurrentUserId = userHandle; } @Override public void onUnlockUser(int userHandle) { - mMountService.onUnlockUser(userHandle); + mStorageManagerService.onUnlockUser(userHandle); } @Override public void onCleanupUser(int userHandle) { - mMountService.onCleanupUser(userHandle); + mStorageManagerService.onCleanupUser(userHandle); } } @@ -209,7 +209,7 @@ class MountService extends IMountService.Stub */ private static final boolean EMULATE_FBE_SUPPORTED = true; - private static final String TAG = "MountService"; + private static final String TAG = "StorageManagerService"; private static final String TAG_STORAGE_BENCHMARK = "storage_benchmark"; private static final String TAG_STORAGE_TRIM = "storage_trim"; @@ -500,7 +500,8 @@ class MountService extends IMountService.Stub final private Map<String, ObbState> mObbPathToStateMap = new HashMap<String, ObbState>(); // Not guarded by a lock. - private final MountServiceInternalImpl mMountServiceInternal = new MountServiceInternalImpl(); + private final StorageManagerInternalImpl mStorageManagerInternal + = new StorageManagerInternalImpl(); class ObbState implements IBinder.DeathRecipient { public ObbState(String rawPath, String canonicalPath, int callingUid, @@ -609,8 +610,8 @@ class MountService extends IMountService.Stub private static final int H_PARTITION_FORGET = 9; private static final int H_RESET = 10; - class MountServiceHandler extends Handler { - public MountServiceHandler(Looper looper) { + class StorageManagerServiceHandler extends Handler { + public StorageManagerServiceHandler(Looper looper) { super(looper); } @@ -661,7 +662,7 @@ class MountService extends IMountService.Stub break; } case H_SHUTDOWN: { - final IMountShutdownObserver obs = (IMountShutdownObserver) msg.obj; + final IStorageShutdownObserver obs = (IStorageShutdownObserver) msg.obj; boolean success = false; try { success = mConnector.execute("volume", "shutdown").isClassOk(); @@ -1481,11 +1482,11 @@ class MountService extends IMountService.Stub } /** - * Constructs a new MountService instance + * Constructs a new StorageManagerService instance * * @param context Binder context for this service */ - public MountService(Context context) { + public StorageManagerService(Context context) { sSelf = this; mContext = context; @@ -1497,9 +1498,9 @@ class MountService extends IMountService.Stub HandlerThread hthread = new HandlerThread(TAG); hthread.start(); - mHandler = new MountServiceHandler(hthread.getLooper()); + mHandler = new StorageManagerServiceHandler(hthread.getLooper()); - // Add OBB Action Handler to MountService thread. + // Add OBB Action Handler to StorageManagerService thread. mObbActionHandler = new ObbActionHandler(IoThread.get().getLooper()); // Initialize the last-fstrim tracking if necessary @@ -1525,7 +1526,7 @@ class MountService extends IMountService.Stub readSettingsLocked(); } - LocalServices.addService(MountServiceInternal.class, mMountServiceInternal); + LocalServices.addService(StorageManagerInternal.class, mStorageManagerInternal); /* * Create the connection to vold with a maximum queue of twice the @@ -1685,17 +1686,17 @@ class MountService extends IMountService.Stub */ @Override - public void registerListener(IMountServiceListener listener) { + public void registerListener(IStorageEventListener listener) { mCallbacks.register(listener); } @Override - public void unregisterListener(IMountServiceListener listener) { + public void unregisterListener(IStorageEventListener listener) { mCallbacks.unregister(listener); } @Override - public void shutdown(final IMountShutdownObserver observer) { + public void shutdown(final IStorageShutdownObserver observer) { enforcePermission(android.Manifest.permission.SHUTDOWN); Slog.i(TAG, "Shutting down"); @@ -3045,7 +3046,7 @@ class MountService extends IMountService.Stub final long token = Binder.clearCallingIdentity(); try { userKeyUnlocked = isUserKeyUnlocked(userId); - storagePermission = mMountServiceInternal.hasExternalStorage(uid, packageName); + storagePermission = mStorageManagerInternal.hasExternalStorage(uid, packageName); } finally { Binder.restoreCallingIdentity(token); } @@ -3162,7 +3163,7 @@ class MountService extends IMountService.Stub for (final ObbState o : obbStates) { if (o.rawPath.equals(obbState.rawPath)) { throw new IllegalStateException("Attempt to add ObbState twice. " - + "This indicates an error in the MountService logic."); + + "This indicates an error in the StorageManagerService logic."); } } } @@ -3424,7 +3425,7 @@ class MountService extends IMountService.Stub try { mObbState.token.onObbResult(mObbState.rawPath, mObbState.nonce, status); } catch (RemoteException e) { - Slog.w(TAG, "MountServiceListener went away while calling onObbStateChanged"); + Slog.w(TAG, "StorageEventListener went away while calling onObbStateChanged"); } } } @@ -3614,18 +3615,18 @@ class MountService extends IMountService.Stub private static final int MSG_DISK_SCANNED = 5; private static final int MSG_DISK_DESTROYED = 6; - private final RemoteCallbackList<IMountServiceListener> + private final RemoteCallbackList<IStorageEventListener> mCallbacks = new RemoteCallbackList<>(); public Callbacks(Looper looper) { super(looper); } - public void register(IMountServiceListener callback) { + public void register(IStorageEventListener callback) { mCallbacks.register(callback); } - public void unregister(IMountServiceListener callback) { + public void unregister(IStorageEventListener callback) { mCallbacks.unregister(callback); } @@ -3634,7 +3635,7 @@ class MountService extends IMountService.Stub final SomeArgs args = (SomeArgs) msg.obj; final int n = mCallbacks.beginBroadcast(); for (int i = 0; i < n; i++) { - final IMountServiceListener callback = mCallbacks.getBroadcastItem(i); + final IStorageEventListener callback = mCallbacks.getBroadcastItem(i); try { invokeCallback(callback, msg.what, args); } catch (RemoteException ignored) { @@ -3644,7 +3645,7 @@ class MountService extends IMountService.Stub args.recycle(); } - private void invokeCallback(IMountServiceListener callback, int what, SomeArgs args) + private void invokeCallback(IStorageEventListener callback, int what, SomeArgs args) throws RemoteException { switch (what) { case MSG_STORAGE_STATE_CHANGED: { @@ -3829,7 +3830,7 @@ class MountService extends IMountService.Stub } } - private final class MountServiceInternalImpl extends MountServiceInternal { + private final class StorageManagerInternalImpl extends StorageManagerInternal { // Not guarded by a lock. private final CopyOnWriteArrayList<ExternalStorageMountPolicy> mPolicies = new CopyOnWriteArrayList<>(); diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index e080fd971da1..787a7d656296 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -196,8 +196,8 @@ import android.os.UpdateLock; import android.os.UserHandle; import android.os.UserManager; import android.os.WorkSource; -import android.os.storage.IMountService; -import android.os.storage.MountServiceInternal; +import android.os.storage.IStorageManager; +import android.os.storage.StorageManagerInternal; import android.os.storage.StorageManager; import android.provider.Settings; import android.service.voice.IVoiceInteractionSession; @@ -2097,9 +2097,9 @@ public class ActivityManagerService extends IActivityManager.Stub try { Locale l = (Locale) msg.obj; IBinder service = ServiceManager.getService("mount"); - IMountService mountService = IMountService.Stub.asInterface(service); + IStorageManager storageManager = IStorageManager.Stub.asInterface(service); Log.d(TAG, "Storing locale " + l.toLanguageTag() + " for decryption UI"); - mountService.setField(StorageManager.SYSTEM_LOCALE_KEY, l.toLanguageTag()); + storageManager.setField(StorageManager.SYSTEM_LOCALE_KEY, l.toLanguageTag()); } catch (RemoteException e) { Log.e(TAG, "Error storing locale for decryption UI", e); } @@ -3599,9 +3599,9 @@ public class ActivityManagerService extends IActivityManager.Stub final IPackageManager pm = AppGlobals.getPackageManager(); permGids = pm.getPackageGids(app.info.packageName, MATCH_DEBUG_TRIAGED_MISSING, app.userId); - MountServiceInternal mountServiceInternal = LocalServices.getService( - MountServiceInternal.class); - mountExternal = mountServiceInternal.getExternalStorageMountMode(uid, + StorageManagerInternal storageManagerInternal = LocalServices.getService( + StorageManagerInternal.class); + mountExternal = storageManagerInternal.getExternalStorageMountMode(uid, app.info.packageName); } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index 96978551d56e..a0a04bbc3bd5 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -75,7 +75,7 @@ import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.os.UserManagerInternal; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.util.ArraySet; import android.util.IntArray; @@ -735,8 +735,8 @@ final class UserController { } } - private IMountService getMountService() { - return IMountService.Stub.asInterface(ServiceManager.getService("mount")); + private IStorageManager getStorageManager() { + return IStorageManager.Stub.asInterface(ServiceManager.getService("mount")); } /** @@ -980,10 +980,10 @@ final class UserController { // TODO Move this block outside of synchronized if it causes lock contention if (!StorageManager.isUserKeyUnlocked(userId)) { final UserInfo userInfo = getUserInfo(userId); - final IMountService mountService = getMountService(); + final IStorageManager storageManager = getStorageManager(); try { // We always want to unlock user storage, even user is not started yet - mountService.unlockUserKey(userId, userInfo.serialNumber, token, secret); + storageManager.unlockUserKey(userId, userInfo.serialNumber, token, secret); } catch (RemoteException | RuntimeException e) { Slog.w(TAG, "Failed to unlock: " + e.getMessage()); } diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index d9e7019bf9de..de801a519870 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -192,8 +192,8 @@ import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; import android.os.UserManagerInternal; -import android.os.storage.IMountService; -import android.os.storage.MountServiceInternal; +import android.os.storage.IStorageManager; +import android.os.storage.StorageManagerInternal; import android.os.storage.StorageEventListener; import android.os.storage.StorageManager; import android.os.storage.VolumeInfo; @@ -1470,10 +1470,11 @@ public class PackageManagerService extends IPackageManager.Stub { } if (reportStatus) { try { - if (DEBUG_SD_INSTALL) Log.i(TAG, "Invoking MountService call back"); - PackageHelper.getMountService().finishMediaUpdate(); + if (DEBUG_SD_INSTALL) Log.i(TAG, + "Invoking StorageManagerService call back"); + PackageHelper.getStorageManager().finishMediaUpdate(); } catch (RemoteException e) { - Log.e(TAG, "MountService not running?"); + Log.e(TAG, "StorageManagerService not running?"); } } } break; @@ -4133,9 +4134,9 @@ public class PackageManagerService extends IPackageManager.Stub { final long token = Binder.clearCallingIdentity(); try { if (sUserManager.isInitialized(userId)) { - MountServiceInternal mountServiceInternal = LocalServices.getService( - MountServiceInternal.class); - mountServiceInternal.onExternalStoragePolicyChanged(uid, packageName); + StorageManagerInternal storageManagerInternal = LocalServices.getService( + StorageManagerInternal.class); + storageManagerInternal.onExternalStoragePolicyChanged(uid, packageName); } } finally { Binder.restoreCallingIdentity(token); @@ -7238,15 +7239,15 @@ public class PackageManagerService extends IPackageManager.Stub { // Before everything else, see whether we need to fstrim. try { - IMountService ms = PackageHelper.getMountService(); - if (ms != null) { + IStorageManager sm = PackageHelper.getStorageManager(); + if (sm != null) { boolean doTrim = false; final long interval = android.provider.Settings.Global.getLong( mContext.getContentResolver(), android.provider.Settings.Global.FSTRIM_MANDATORY_INTERVAL, DEFAULT_MANDATORY_FSTRIM_INTERVAL); if (interval > 0) { - final long timeSinceLast = System.currentTimeMillis() - ms.lastMaintenance(); + final long timeSinceLast = System.currentTimeMillis() - sm.lastMaintenance(); if (timeSinceLast > interval) { doTrim = true; Slog.w(TAG, "No disk maintenance in " + timeSinceLast @@ -7266,13 +7267,13 @@ public class PackageManagerService extends IPackageManager.Stub { } catch (RemoteException e) { } } - ms.runMaintenance(); + sm.runMaintenance(); } } else { - Slog.e(TAG, "Mount service unavailable!"); + Slog.e(TAG, "storageManager service unavailable!"); } } catch (RemoteException e) { - // Can't happen; MountService is local + // Can't happen; StorageManagerService is local } } @@ -13810,7 +13811,7 @@ public class PackageManagerService extends IPackageManager.Stub { } /** - * Extract the MountService "container ID" from the full code path of an + * Extract the StorageManagerService "container ID" from the full code path of an * .apk. */ static String cidFromCodePath(String fullCodePath) { @@ -18411,10 +18412,10 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName()); mInstallerService.systemReady(); mPackageDexOptimizer.systemReady(); - MountServiceInternal mountServiceInternal = LocalServices.getService( - MountServiceInternal.class); - mountServiceInternal.addExternalStoragePolicy( - new MountServiceInternal.ExternalStorageMountPolicy() { + StorageManagerInternal StorageManagerInternal = LocalServices.getService( + StorageManagerInternal.class); + StorageManagerInternal.addExternalStoragePolicy( + new StorageManagerInternal.ExternalStorageMountPolicy() { @Override public int getMountMode(int uid, String packageName) { if (Process.isIsolated(uid)) { @@ -19292,7 +19293,7 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName()); } /** - * Called by MountService when the initial ASECs to scan are available. + * Called by StorageManagerService when the initial ASECs to scan are available. * Should block until all the ASEC containers are finished being scanned. */ public void scanAvailableAsecs() { diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java index a920d5457a2d..cd966ef323b7 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -43,8 +43,8 @@ import android.os.UserHandle; import android.os.UserManager; import android.os.Vibrator; import android.os.SystemVibrator; -import android.os.storage.IMountService; -import android.os.storage.IMountShutdownObserver; +import android.os.storage.IStorageShutdownObserver; +import android.os.storage.IStorageManager; import android.system.ErrnoException; import android.system.Os; @@ -442,30 +442,30 @@ public final class ShutdownThread extends Thread { sInstance.setRebootProgress(RADIO_STOP_PERCENT, null); } - // Shutdown MountService to ensure media is in a safe state - IMountShutdownObserver observer = new IMountShutdownObserver.Stub() { + // Shutdown StorageManagerService to ensure media is in a safe state + IStorageShutdownObserver observer = new IStorageShutdownObserver.Stub() { public void onShutDownComplete(int statusCode) throws RemoteException { - Log.w(TAG, "Result code " + statusCode + " from MountService.shutdown"); + Log.w(TAG, "Result code " + statusCode + " from StorageManagerService.shutdown"); actionDone(); } }; - Log.i(TAG, "Shutting down MountService"); + Log.i(TAG, "Shutting down StorageManagerService"); // Set initial variables and time out time. mActionDone = false; final long endShutTime = SystemClock.elapsedRealtime() + MAX_SHUTDOWN_WAIT_TIME; synchronized (mActionDoneSync) { try { - final IMountService mount = IMountService.Stub.asInterface( + final IStorageManager storageManager = IStorageManager.Stub.asInterface( ServiceManager.checkService("mount")); - if (mount != null) { - mount.shutdown(observer); + if (storageManager != null) { + storageManager.shutdown(observer); } else { - Log.w(TAG, "MountService unavailable for shutdown"); + Log.w(TAG, "StorageManagerService unavailable for shutdown"); } } catch (Exception e) { - Log.e(TAG, "Exception during MountService shutdown", e); + Log.e(TAG, "Exception during StorageManagerService shutdown", e); } while (!mActionDone) { long delay = endShutTime - SystemClock.elapsedRealtime(); diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 3db24fa28d9f..1202025751c7 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -42,7 +42,7 @@ import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; -import android.os.storage.IMountService; +import android.os.storage.IStorageManager; import android.provider.Settings; import android.util.DisplayMetrics; import android.util.EventLog; @@ -167,8 +167,8 @@ public final class SystemServer { "com.android.server.job.JobSchedulerService"; private static final String LOCK_SETTINGS_SERVICE_CLASS = "com.android.server.LockSettingsService$Lifecycle"; - private static final String MOUNT_SERVICE_CLASS = - "com.android.server.MountService$Lifecycle"; + private static final String STORAGE_MANAGER_SERVICE_CLASS = + "com.android.server.StorageManagerService$Lifecycle"; private static final String SEARCH_MANAGER_SERVICE_CLASS = "com.android.server.search.SearchManagerService$Lifecycle"; private static final String THERMAL_OBSERVER_CLASS = @@ -572,7 +572,7 @@ public final class SystemServer { private void startOtherServices() { final Context context = mSystemContext; VibratorService vibrator = null; - IMountService mountService = null; + IStorageManager storageManager = null; NetworkManagementService networkManagement = null; NetworkStatsService networkStats = null; NetworkPolicyManagerService networkPolicy = null; @@ -784,17 +784,17 @@ public final class SystemServer { if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) { if (!disableStorage && !"0".equals(SystemProperties.get("system_init.startmountservice"))) { - traceBeginAndSlog("StartMountService"); + traceBeginAndSlog("StartStorageManagerService"); try { /* - * NotificationManagerService is dependant on MountService, - * (for media / usb notifications) so we must start MountService first. + * NotificationManagerService is dependant on StorageManagerService, + * (for media / usb notifications) so we must start StorageManagerService first. */ - mSystemServiceManager.startService(MOUNT_SERVICE_CLASS); - mountService = IMountService.Stub.asInterface( + mSystemServiceManager.startService(STORAGE_MANAGER_SERVICE_CLASS); + storageManager = IStorageManager.Stub.asInterface( ServiceManager.getService("mount")); } catch (Throwable e) { - reportWtf("starting Mount Service", e); + reportWtf("starting StorageManager Service", e); } traceEnd(); } @@ -993,14 +993,14 @@ public final class SystemServer { } /* - * MountService has a few dependencies: Notification Manager and - * AppWidget Provider. Make sure MountService is completely started + * StorageManagerService has a few dependencies: Notification Manager and + * AppWidget Provider. Make sure StorageManagerService is completely started * first before continuing. */ - if (mountService != null && !mOnlyCore) { + if (storageManager != null && !mOnlyCore) { traceBeginAndSlog("WaitForAsecScan"); try { - mountService.waitForAsecScan(); + storageManager.waitForAsecScan(); } catch (RemoteException ignored) { } traceEnd(); -- GitLab