Add DataUnit to clarify SI-vs-IEC units.

Mirrors the design of TimeUnit and ChronoUnit which many developers
are already familiar with, making it easy to pick up and use.

Yes, this is an enum.

Bug: 70915728
Test: bit FrameworksCoreTests:android.util.DataUnitTest
Change-Id: Id0cfdac5c81ed89c3c9ece23c964acba4a4f8471
This commit is contained in:
Jeff Sharkey
2018-01-07 16:47:31 -07:00
parent c080279fe4
commit a6886af481

View File

@@ -27,6 +27,7 @@ import android.content.Context;
import android.media.MediaPlayer;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.DataUnit;
import com.android.server.NetworkManagementSocketTagger;
@@ -56,15 +57,20 @@ public class TrafficStats {
*/
public final static int UNSUPPORTED = -1;
/** @hide */
/** @hide @deprecated use {@link DataUnit} instead to clarify SI-vs-IEC */
@Deprecated
public static final long KB_IN_BYTES = 1024;
/** @hide */
/** @hide @deprecated use {@link DataUnit} instead to clarify SI-vs-IEC */
@Deprecated
public static final long MB_IN_BYTES = KB_IN_BYTES * 1024;
/** @hide */
/** @hide @deprecated use {@link DataUnit} instead to clarify SI-vs-IEC */
@Deprecated
public static final long GB_IN_BYTES = MB_IN_BYTES * 1024;
/** @hide */
/** @hide @deprecated use {@link DataUnit} instead to clarify SI-vs-IEC */
@Deprecated
public static final long TB_IN_BYTES = GB_IN_BYTES * 1024;
/** @hide */
/** @hide @deprecated use {@link DataUnit} instead to clarify SI-vs-IEC */
@Deprecated
public static final long PB_IN_BYTES = TB_IN_BYTES * 1024;
/**