Merge "Fixed a race contidion in StorageManagerService"
This commit is contained in:
@@ -200,6 +200,21 @@ public class VolumeInfo implements Parcelable {
|
|||||||
internalPath = parcel.readString8();
|
internalPath = parcel.readString8();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VolumeInfo(VolumeInfo volumeInfo) {
|
||||||
|
this.id = volumeInfo.id;
|
||||||
|
this.type = volumeInfo.type;
|
||||||
|
this.disk = volumeInfo.disk;
|
||||||
|
this.partGuid = volumeInfo.partGuid;
|
||||||
|
this.mountFlags = volumeInfo.mountFlags;
|
||||||
|
this.mountUserId = volumeInfo.mountUserId;
|
||||||
|
this.state = volumeInfo.state;
|
||||||
|
this.fsType = volumeInfo.fsType;
|
||||||
|
this.fsUuid = volumeInfo.fsUuid;
|
||||||
|
this.fsLabel = volumeInfo.fsLabel;
|
||||||
|
this.path = volumeInfo.path;
|
||||||
|
this.internalPath = volumeInfo.internalPath;
|
||||||
|
}
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public static @NonNull String getEnvironmentForState(int state) {
|
public static @NonNull String getEnvironmentForState(int state) {
|
||||||
final String envState = sStateToEnvironment.get(state);
|
final String envState = sStateToEnvironment.get(state);
|
||||||
|
|||||||
@@ -1391,12 +1391,13 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
final int oldState = vol.state;
|
final int oldState = vol.state;
|
||||||
final int newState = state;
|
final int newState = state;
|
||||||
vol.state = newState;
|
vol.state = newState;
|
||||||
|
final VolumeInfo vInfo = new VolumeInfo(vol);
|
||||||
final SomeArgs args = SomeArgs.obtain();
|
final SomeArgs args = SomeArgs.obtain();
|
||||||
args.arg1 = vol;
|
args.arg1 = vInfo;
|
||||||
args.arg2 = oldState;
|
args.arg2 = oldState;
|
||||||
args.arg3 = newState;
|
args.arg3 = newState;
|
||||||
mHandler.obtainMessage(H_VOLUME_STATE_CHANGED, args).sendToTarget();
|
mHandler.obtainMessage(H_VOLUME_STATE_CHANGED, args).sendToTarget();
|
||||||
onVolumeStateChangedLocked(vol, oldState, newState);
|
onVolumeStateChangedLocked(vInfo, oldState, newState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user