Loading core/java/android/os/storage/IMountServiceListener.java +26 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,13 @@ public interface IMountServiceListener extends IInterface { reply.writeNoException(); return true; } case TRANSACTION_onDiskDestroyed: { data.enforceInterface(DESCRIPTOR); final DiskInfo disk = (DiskInfo) data.readParcelable(null); onDiskDestroyed(disk); reply.writeNoException(); return true; } } return super.onTransact(code, data, reply, flags); } Loading Loading @@ -246,6 +253,22 @@ public interface IMountServiceListener extends IInterface { _data.recycle(); } } @Override public void onDiskDestroyed(DiskInfo disk) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeParcelable(disk, 0); mRemote.transact(Stub.TRANSACTION_onDiskDestroyed, _data, _reply, android.os.IBinder.FLAG_ONEWAY); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } } static final int TRANSACTION_onUsbMassStorageConnectionChanged = (IBinder.FIRST_CALL_TRANSACTION + 0); Loading @@ -254,6 +277,7 @@ public interface IMountServiceListener extends IInterface { static final int TRANSACTION_onVolumeRecordChanged = (IBinder.FIRST_CALL_TRANSACTION + 3); static final int TRANSACTION_onVolumeForgotten = (IBinder.FIRST_CALL_TRANSACTION + 4); static final int TRANSACTION_onDiskScanned = (IBinder.FIRST_CALL_TRANSACTION + 5); static final int TRANSACTION_onDiskDestroyed = (IBinder.FIRST_CALL_TRANSACTION + 6); } /** Loading @@ -280,4 +304,6 @@ public interface IMountServiceListener extends IInterface { public void onVolumeForgotten(String fsUuid) throws RemoteException; public void onDiskScanned(DiskInfo disk, int volumeCount) throws RemoteException; public void onDiskDestroyed(DiskInfo disk) throws RemoteException; } core/java/android/os/storage/StorageEventListener.java +3 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,7 @@ public class StorageEventListener { public void onDiskScanned(DiskInfo disk, int volumeCount) { } public void onDiskDestroyed(DiskInfo disk) { } } core/java/android/os/storage/StorageManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public class StorageManager { private static final int MSG_VOLUME_RECORD_CHANGED = 3; private static final int MSG_VOLUME_FORGOTTEN = 4; private static final int MSG_DISK_SCANNED = 5; private static final int MSG_DISK_DESTROYED = 6; final StorageEventListener mCallback; final Handler mHandler; Loading Loading @@ -135,6 +136,10 @@ public class StorageManager { mCallback.onDiskScanned((DiskInfo) args.arg1, args.argi2); args.recycle(); return true; case MSG_DISK_DESTROYED: mCallback.onDiskDestroyed((DiskInfo) args.arg1); args.recycle(); return true; } args.recycle(); return false; Loading Loading @@ -184,6 +189,13 @@ public class StorageManager { args.argi2 = volumeCount; mHandler.obtainMessage(MSG_DISK_SCANNED, args).sendToTarget(); } @Override public void onDiskDestroyed(DiskInfo disk) throws RemoteException { final SomeArgs args = SomeArgs.obtain(); args.arg1 = disk; mHandler.obtainMessage(MSG_DISK_DESTROYED, args).sendToTarget(); } } /** Loading services/core/java/com/android/server/MountService.java +15 −1 Original line number Diff line number Diff line Loading @@ -890,7 +890,10 @@ class MountService extends IMountService.Stub } case VoldResponseCode.DISK_DESTROYED: { if (cooked.length != 2) break; mDisks.remove(cooked[1]); final DiskInfo disk = mDisks.remove(cooked[1]); if (disk != null) { mCallbacks.notifyDiskDestroyed(disk); } break; } Loading Loading @@ -2971,6 +2974,7 @@ class MountService extends IMountService.Stub private static final int MSG_VOLUME_RECORD_CHANGED = 3; private static final int MSG_VOLUME_FORGOTTEN = 4; private static final int MSG_DISK_SCANNED = 5; private static final int MSG_DISK_DESTROYED = 6; private final RemoteCallbackList<IMountServiceListener> mCallbacks = new RemoteCallbackList<>(); Loading Loading @@ -3026,6 +3030,10 @@ class MountService extends IMountService.Stub callback.onDiskScanned((DiskInfo) args.arg1, args.argi2); break; } case MSG_DISK_DESTROYED: { callback.onDiskDestroyed((DiskInfo) args.arg1); break; } } } Loading Loading @@ -3063,6 +3071,12 @@ class MountService extends IMountService.Stub args.argi2 = volumeCount; obtainMessage(MSG_DISK_SCANNED, args).sendToTarget(); } private void notifyDiskDestroyed(DiskInfo disk) { final SomeArgs args = SomeArgs.obtain(); args.arg1 = disk.clone(); obtainMessage(MSG_DISK_DESTROYED, args).sendToTarget(); } } @Override Loading Loading
core/java/android/os/storage/IMountServiceListener.java +26 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,13 @@ public interface IMountServiceListener extends IInterface { reply.writeNoException(); return true; } case TRANSACTION_onDiskDestroyed: { data.enforceInterface(DESCRIPTOR); final DiskInfo disk = (DiskInfo) data.readParcelable(null); onDiskDestroyed(disk); reply.writeNoException(); return true; } } return super.onTransact(code, data, reply, flags); } Loading Loading @@ -246,6 +253,22 @@ public interface IMountServiceListener extends IInterface { _data.recycle(); } } @Override public void onDiskDestroyed(DiskInfo disk) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeParcelable(disk, 0); mRemote.transact(Stub.TRANSACTION_onDiskDestroyed, _data, _reply, android.os.IBinder.FLAG_ONEWAY); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } } static final int TRANSACTION_onUsbMassStorageConnectionChanged = (IBinder.FIRST_CALL_TRANSACTION + 0); Loading @@ -254,6 +277,7 @@ public interface IMountServiceListener extends IInterface { static final int TRANSACTION_onVolumeRecordChanged = (IBinder.FIRST_CALL_TRANSACTION + 3); static final int TRANSACTION_onVolumeForgotten = (IBinder.FIRST_CALL_TRANSACTION + 4); static final int TRANSACTION_onDiskScanned = (IBinder.FIRST_CALL_TRANSACTION + 5); static final int TRANSACTION_onDiskDestroyed = (IBinder.FIRST_CALL_TRANSACTION + 6); } /** Loading @@ -280,4 +304,6 @@ public interface IMountServiceListener extends IInterface { public void onVolumeForgotten(String fsUuid) throws RemoteException; public void onDiskScanned(DiskInfo disk, int volumeCount) throws RemoteException; public void onDiskDestroyed(DiskInfo disk) throws RemoteException; }
core/java/android/os/storage/StorageEventListener.java +3 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,7 @@ public class StorageEventListener { public void onDiskScanned(DiskInfo disk, int volumeCount) { } public void onDiskDestroyed(DiskInfo disk) { } }
core/java/android/os/storage/StorageManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public class StorageManager { private static final int MSG_VOLUME_RECORD_CHANGED = 3; private static final int MSG_VOLUME_FORGOTTEN = 4; private static final int MSG_DISK_SCANNED = 5; private static final int MSG_DISK_DESTROYED = 6; final StorageEventListener mCallback; final Handler mHandler; Loading Loading @@ -135,6 +136,10 @@ public class StorageManager { mCallback.onDiskScanned((DiskInfo) args.arg1, args.argi2); args.recycle(); return true; case MSG_DISK_DESTROYED: mCallback.onDiskDestroyed((DiskInfo) args.arg1); args.recycle(); return true; } args.recycle(); return false; Loading Loading @@ -184,6 +189,13 @@ public class StorageManager { args.argi2 = volumeCount; mHandler.obtainMessage(MSG_DISK_SCANNED, args).sendToTarget(); } @Override public void onDiskDestroyed(DiskInfo disk) throws RemoteException { final SomeArgs args = SomeArgs.obtain(); args.arg1 = disk; mHandler.obtainMessage(MSG_DISK_DESTROYED, args).sendToTarget(); } } /** Loading
services/core/java/com/android/server/MountService.java +15 −1 Original line number Diff line number Diff line Loading @@ -890,7 +890,10 @@ class MountService extends IMountService.Stub } case VoldResponseCode.DISK_DESTROYED: { if (cooked.length != 2) break; mDisks.remove(cooked[1]); final DiskInfo disk = mDisks.remove(cooked[1]); if (disk != null) { mCallbacks.notifyDiskDestroyed(disk); } break; } Loading Loading @@ -2971,6 +2974,7 @@ class MountService extends IMountService.Stub private static final int MSG_VOLUME_RECORD_CHANGED = 3; private static final int MSG_VOLUME_FORGOTTEN = 4; private static final int MSG_DISK_SCANNED = 5; private static final int MSG_DISK_DESTROYED = 6; private final RemoteCallbackList<IMountServiceListener> mCallbacks = new RemoteCallbackList<>(); Loading Loading @@ -3026,6 +3030,10 @@ class MountService extends IMountService.Stub callback.onDiskScanned((DiskInfo) args.arg1, args.argi2); break; } case MSG_DISK_DESTROYED: { callback.onDiskDestroyed((DiskInfo) args.arg1); break; } } } Loading Loading @@ -3063,6 +3071,12 @@ class MountService extends IMountService.Stub args.argi2 = volumeCount; obtainMessage(MSG_DISK_SCANNED, args).sendToTarget(); } private void notifyDiskDestroyed(DiskInfo disk) { final SomeArgs args = SomeArgs.obtain(); args.arg1 = disk.clone(); obtainMessage(MSG_DISK_DESTROYED, args).sendToTarget(); } } @Override Loading