diff options
31 files changed, 1173 insertions, 39 deletions
diff --git a/Android.bp b/Android.bp index ce73d4b83533..704ec8789cb6 100644 --- a/Android.bp +++ b/Android.bp @@ -828,7 +828,9 @@ java_library { srcs: [ "core/java/android/os/HidlSupport.java", + "core/java/android/annotation/IntDef.java", "core/java/android/annotation/NonNull.java", + "core/java/android/annotation/SystemApi.java", "core/java/android/os/HwBinder.java", "core/java/android/os/HwBlob.java", "core/java/android/os/HwParcel.java", diff --git a/api/current.txt b/api/current.txt index 7ad859fe598c..61465acd362c 100644 --- a/api/current.txt +++ b/api/current.txt @@ -44878,42 +44878,42 @@ package android.util { method public void previousMonth(); } - public final class MutableBoolean { + public final deprecated class MutableBoolean { ctor public MutableBoolean(boolean); field public boolean value; } - public final class MutableByte { + public final deprecated class MutableByte { ctor public MutableByte(byte); field public byte value; } - public final class MutableChar { + public final deprecated class MutableChar { ctor public MutableChar(char); field public char value; } - public final class MutableDouble { + public final deprecated class MutableDouble { ctor public MutableDouble(double); field public double value; } - public final class MutableFloat { + public final deprecated class MutableFloat { ctor public MutableFloat(float); field public float value; } - public final class MutableInt { + public final deprecated class MutableInt { ctor public MutableInt(int); field public int value; } - public final class MutableLong { + public final deprecated class MutableLong { ctor public MutableLong(long); field public long value; } - public final class MutableShort { + public final deprecated class MutableShort { ctor public MutableShort(short); field public short value; } diff --git a/api/system-current.txt b/api/system-current.txt index b6b0562db296..58d06b3a8ae0 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -3483,6 +3483,125 @@ package android.os { field public static final java.lang.String ACTION_UPDATE_SMS_SHORT_CODES = "android.intent.action.UPDATE_SMS_SHORT_CODES"; } + public class HidlSupport { + method public static boolean deepEquals(java.lang.Object, java.lang.Object); + method public static int deepHashCode(java.lang.Object); + method public static boolean interfacesEqual(android.os.IHwInterface, java.lang.Object); + } + + public abstract class HwBinder implements android.os.IHwBinder { + method public static final void configureRpcThreadpool(long, boolean); + method public static final void joinRpcThreadpool(); + } + + public class HwBlob { + ctor public HwBlob(int); + method public final void copyToBoolArray(long, boolean[], int); + method public final void copyToDoubleArray(long, double[], int); + method public final void copyToFloatArray(long, float[], int); + method public final void copyToInt16Array(long, short[], int); + method public final void copyToInt32Array(long, int[], int); + method public final void copyToInt64Array(long, long[], int); + method public final void copyToInt8Array(long, byte[], int); + method public final boolean getBool(long); + method public final double getDouble(long); + method public final float getFloat(long); + method public final short getInt16(long); + method public final int getInt32(long); + method public final long getInt64(long); + method public final byte getInt8(long); + method public final java.lang.String getString(long); + method public final long handle(); + method public final void putBlob(long, android.os.HwBlob); + method public final void putBool(long, boolean); + method public final void putBoolArray(long, boolean[]); + method public final void putDouble(long, double); + method public final void putDoubleArray(long, double[]); + method public final void putFloat(long, float); + method public final void putFloatArray(long, float[]); + method public final void putInt16(long, short); + method public final void putInt16Array(long, short[]); + method public final void putInt32(long, int); + method public final void putInt32Array(long, int[]); + method public final void putInt64(long, long); + method public final void putInt64Array(long, long[]); + method public final void putInt8(long, byte); + method public final void putInt8Array(long, byte[]); + method public final void putString(long, java.lang.String); + method public static java.lang.Boolean[] wrapArray(boolean[]); + method public static java.lang.Long[] wrapArray(long[]); + method public static java.lang.Byte[] wrapArray(byte[]); + method public static java.lang.Short[] wrapArray(short[]); + method public static java.lang.Integer[] wrapArray(int[]); + method public static java.lang.Float[] wrapArray(float[]); + method public static java.lang.Double[] wrapArray(double[]); + } + + public class HwParcel { + ctor public HwParcel(); + method public final void enforceInterface(java.lang.String); + method public final boolean readBool(); + method public final java.util.ArrayList<java.lang.Boolean> readBoolVector(); + method public final android.os.HwBlob readBuffer(long); + method public final double readDouble(); + method public final java.util.ArrayList<java.lang.Double> readDoubleVector(); + method public final android.os.HwBlob readEmbeddedBuffer(long, long, long, boolean); + method public final float readFloat(); + method public final java.util.ArrayList<java.lang.Float> readFloatVector(); + method public final short readInt16(); + method public final java.util.ArrayList<java.lang.Short> readInt16Vector(); + method public final int readInt32(); + method public final java.util.ArrayList<java.lang.Integer> readInt32Vector(); + method public final long readInt64(); + method public final java.util.ArrayList<java.lang.Long> readInt64Vector(); + method public final byte readInt8(); + method public final java.util.ArrayList<java.lang.Byte> readInt8Vector(); + method public final java.lang.String readString(); + method public final java.util.ArrayList<java.lang.String> readStringVector(); + method public final android.os.IHwBinder readStrongBinder(); + method public final void release(); + method public final void releaseTemporaryStorage(); + method public final void send(); + method public final void verifySuccess(); + method public final void writeBool(boolean); + method public final void writeBoolVector(java.util.ArrayList<java.lang.Boolean>); + method public final void writeBuffer(android.os.HwBlob); + method public final void writeDouble(double); + method public final void writeDoubleVector(java.util.ArrayList<java.lang.Double>); + method public final void writeFloat(float); + method public final void writeFloatVector(java.util.ArrayList<java.lang.Float>); + method public final void writeInt16(short); + method public final void writeInt16Vector(java.util.ArrayList<java.lang.Short>); + method public final void writeInt32(int); + method public final void writeInt32Vector(java.util.ArrayList<java.lang.Integer>); + method public final void writeInt64(long); + method public final void writeInt64Vector(java.util.ArrayList<java.lang.Long>); + method public final void writeInt8(byte); + method public final void writeInt8Vector(java.util.ArrayList<java.lang.Byte>); + method public final void writeInterfaceToken(java.lang.String); + method public final void writeStatus(int); + method public final void writeString(java.lang.String); + method public final void writeStringVector(java.util.ArrayList<java.lang.String>); + method public final void writeStrongBinder(android.os.IHwBinder); + field public static final int STATUS_SUCCESS = 0; // 0x0 + } + + public static abstract class HwParcel.Status implements java.lang.annotation.Annotation { + } + + public abstract interface IHwBinder { + method public abstract boolean linkToDeath(android.os.IHwBinder.DeathRecipient, long); + method public abstract boolean unlinkToDeath(android.os.IHwBinder.DeathRecipient); + } + + public static abstract interface IHwBinder.DeathRecipient { + method public abstract void serviceDied(long); + } + + public abstract interface IHwInterface { + method public abstract android.os.IHwBinder asBinder(); + } + public class IncidentManager { method public void reportIncident(android.os.IncidentReportArgs); method public void reportIncident(java.lang.String, byte[]); @@ -4706,6 +4825,7 @@ package android.telephony { method public int getSimApplicationState(); method public int getSimCardState(); method public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms(); + method public android.telephony.UiccSlotInfo[] getUiccSlotsInfo(); method public android.os.Bundle getVisualVoicemailSettings(); method public int getVoiceActivationState(); method public boolean handlePinMmi(java.lang.String); @@ -4732,6 +4852,7 @@ package android.telephony { method public int[] supplyPinReportResult(java.lang.String); method public boolean supplyPuk(java.lang.String, java.lang.String); method public int[] supplyPukReportResult(java.lang.String, java.lang.String); + method public boolean switchSlots(int[]); method public void toggleRadioOnOff(); method public void updateServiceLocation(); field public static final java.lang.String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED"; @@ -4753,6 +4874,25 @@ package android.telephony { field public static final int SIM_STATE_PRESENT = 11; // 0xb } + public class UiccSlotInfo implements android.os.Parcelable { + ctor public UiccSlotInfo(boolean, boolean, java.lang.String, int); + method public int describeContents(); + method public java.lang.String getCardId(); + method public int getCardStateInfo(); + method public boolean getIsActive(); + method public boolean getIsEuicc(); + method public void writeToParcel(android.os.Parcel, int); + field public static final int CARD_STATE_INFO_ABSENT = 1; // 0x1 + field public static final int CARD_STATE_INFO_ERROR = 3; // 0x3 + field public static final int CARD_STATE_INFO_PRESENT = 2; // 0x2 + field public static final int CARD_STATE_INFO_RESTRICTED = 4; // 0x4 + field public static final android.os.Parcelable.Creator<android.telephony.UiccSlotInfo> CREATOR; + field public final java.lang.String cardId; + field public final int cardStateInfo; + field public final boolean isActive; + field public final boolean isEuicc; + } + public abstract class VisualVoicemailService extends android.app.Service { method public static final void sendVisualVoicemailSms(android.content.Context, android.telecom.PhoneAccountHandle, java.lang.String, short, java.lang.String, android.app.PendingIntent); method public static final void setSmsFilterSettings(android.content.Context, android.telecom.PhoneAccountHandle, android.telephony.VisualVoicemailSmsFilterSettings); diff --git a/cmds/statsd/src/StatsService.cpp b/cmds/statsd/src/StatsService.cpp index ba628b849147..8975c542018c 100644 --- a/cmds/statsd/src/StatsService.cpp +++ b/cmds/statsd/src/StatsService.cpp @@ -380,6 +380,8 @@ status_t StatsService::cmd_config(FILE* in, FILE* out, FILE* err, Vector<String8 "The config can only be set for other UIDs on eng or userdebug " "builds.\n"); } + } else if (argCount == 2 && args[1] == "remove") { + good = true; } if (!good) { diff --git a/cmds/statsd/src/config/ConfigManager.cpp b/cmds/statsd/src/config/ConfigManager.cpp index 42994b558208..496c29b24657 100644 --- a/cmds/statsd/src/config/ConfigManager.cpp +++ b/cmds/statsd/src/config/ConfigManager.cpp @@ -101,8 +101,8 @@ void ConfigManager::RemoveConfig(const ConfigKey& key) { } void ConfigManager::remove_saved_configs(const ConfigKey& key) { - string prefix = StringPrintf("%d-%lld", key.GetUid(), (long long)key.GetId()); - StorageManager::deletePrefixedFiles(STATS_SERVICE_DIR, prefix.c_str()); + string suffix = StringPrintf("%d-%lld", key.GetUid(), (long long)key.GetId()); + StorageManager::deleteSuffixedFiles(STATS_SERVICE_DIR, suffix.c_str()); } void ConfigManager::RemoveConfigs(int uid) { @@ -111,6 +111,7 @@ void ConfigManager::RemoveConfigs(int uid) { for (auto it = mConfigs.begin(); it != mConfigs.end();) { // Remove from map if (it->GetUid() == uid) { + remove_saved_configs(*it); removed.push_back(*it); mConfigReceivers.erase(*it); it = mConfigs.erase(it); diff --git a/cmds/statsd/src/storage/StorageManager.cpp b/cmds/statsd/src/storage/StorageManager.cpp index 1d75e20d7eaa..f12770175132 100644 --- a/cmds/statsd/src/storage/StorageManager.cpp +++ b/cmds/statsd/src/storage/StorageManager.cpp @@ -78,7 +78,7 @@ void StorageManager::deleteAllFiles(const char* path) { } } -void StorageManager::deletePrefixedFiles(const char* path, const char* prefix) { +void StorageManager::deleteSuffixedFiles(const char* path, const char* suffix) { unique_ptr<DIR, decltype(&closedir)> dir(opendir(path), closedir); if (dir == NULL) { VLOG("Directory does not exist: %s", path); @@ -88,10 +88,14 @@ void StorageManager::deletePrefixedFiles(const char* path, const char* prefix) { dirent* de; while ((de = readdir(dir.get()))) { char* name = de->d_name; - if (name[0] == '.' || strncmp(name, prefix, strlen(prefix)) != 0) { + if (name[0] == '.') { continue; } - deleteFile(StringPrintf("%s/%s", path, name).c_str()); + size_t nameLen = strlen(name); + size_t suffixLen = strlen(suffix); + if (suffixLen <= nameLen && strncmp(name + nameLen - suffixLen, suffix, suffixLen) == 0) { + deleteFile(StringPrintf("%s/%s", path, name).c_str()); + } } } diff --git a/cmds/statsd/src/storage/StorageManager.h b/cmds/statsd/src/storage/StorageManager.h index caf5b8b42887..f9988fe8c427 100644 --- a/cmds/statsd/src/storage/StorageManager.h +++ b/cmds/statsd/src/storage/StorageManager.h @@ -47,9 +47,9 @@ public: static void deleteAllFiles(const char* path); /** - * Deletes all files whose name matches with a provided prefix. + * Deletes all files whose name matches with a provided suffix. */ - static void deletePrefixedFiles(const char* path, const char* prefix); + static void deleteSuffixedFiles(const char* path, const char* suffix); /** * Send broadcasts to relevant receiver for each data stored on disk. diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index b5a941283184..80350584bce6 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -181,7 +181,8 @@ public class ActivityManager { BUGREPORT_OPTION_INTERACTIVE, BUGREPORT_OPTION_REMOTE, BUGREPORT_OPTION_WEAR, - BUGREPORT_OPTION_TELEPHONY + BUGREPORT_OPTION_TELEPHONY, + BUGREPORT_OPTION_WIFI }) public @interface BugreportMode {} /** @@ -216,6 +217,12 @@ public class ActivityManager { public static final int BUGREPORT_OPTION_TELEPHONY = 4; /** + * Takes a lightweight bugreport that only includes a few sections related to Wifi. + * @hide + */ + public static final int BUGREPORT_OPTION_WIFI = 5; + + /** * <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code * <meta-data>}</a> name for a 'home' Activity that declares a package that is to be * uninstalled in lieu of the declaring one. The package named here must be diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl index 5f5d834425b6..9c15562b5813 100644 --- a/core/java/android/app/IActivityManager.aidl +++ b/core/java/android/app/IActivityManager.aidl @@ -357,6 +357,20 @@ interface IActivityManager { */ void requestTelephonyBugReport(in String shareTitle, in String shareDescription); + /** + * Deprecated - This method is only used by Wifi, and it will soon be replaced by a proper + * bug report API. + * + * Takes a minimal bugreport of Wifi-related state. + * + * @param shareTitle should be a valid legible string less than 50 chars long + * @param shareDescription should be less than 91 bytes when encoded into UTF-8 format + * + * @throws IllegalArgumentException if shareTitle or shareDescription is too big or if the + * parameters cannot be encoding to an UTF-8 charset. + */ + void requestWifiBugReport(in String shareTitle, in String shareDescription); + long inputDispatchingTimedOut(int pid, boolean aboveSystem, in String reason); void clearPendingBackup(); Intent getIntentForIntentSender(in IIntentSender sender); diff --git a/core/java/android/os/HidlSupport.java b/core/java/android/os/HidlSupport.java index 4d7d9319c94e..335bf9d86fc7 100644 --- a/core/java/android/os/HidlSupport.java +++ b/core/java/android/os/HidlSupport.java @@ -16,6 +16,8 @@ package android.os; +import android.annotation.SystemApi; + import java.util.Arrays; import java.util.Collection; import java.util.Iterator; @@ -25,6 +27,7 @@ import java.util.Objects; import java.util.stream.IntStream; /** @hide */ +@SystemApi public class HidlSupport { /** * Similar to Objects.deepEquals, but also take care of lists. @@ -36,7 +39,9 @@ public class HidlSupport { * 2.3 Both are Lists, elements are checked recursively * 2.4 (If both are collections other than lists or maps, throw an error) * 2.5 lft.equals(rgt) returns true + * @hide */ + @SystemApi public static boolean deepEquals(Object lft, Object rgt) { if (lft == rgt) { return true; @@ -91,6 +96,7 @@ public class HidlSupport { * and should be avoided). * * @param <E> Inner object type. + * @hide */ public static final class Mutable<E> { public E value; @@ -106,7 +112,9 @@ public class HidlSupport { /** * Similar to Arrays.deepHashCode, but also take care of lists. + * @hide */ + @SystemApi public static int deepHashCode(Object o) { if (o == null) { return 0; @@ -133,6 +141,7 @@ public class HidlSupport { return o.hashCode(); } + /** @hide */ private static void throwErrorIfUnsupportedType(Object o) { if (o instanceof Collection<?> && !(o instanceof List<?>)) { throw new UnsupportedOperationException( @@ -146,6 +155,7 @@ public class HidlSupport { } } + /** @hide */ private static int primitiveArrayHashCode(Object o) { Class<?> elementType = o.getClass().getComponentType(); if (elementType == boolean.class) { @@ -185,7 +195,9 @@ public class HidlSupport { * - If both interfaces are stubs, asBinder() returns the object itself. By default, * auto-generated IFoo.Stub does not override equals(), but an implementation can * optionally override it, and {@code interfacesEqual} will use it here. + * @hide */ + @SystemApi public static boolean interfacesEqual(IHwInterface lft, Object rgt) { if (lft == rgt) { return true; @@ -201,6 +213,10 @@ public class HidlSupport { /** * Return PID of process if sharable to clients. + * @hide */ public static native int getPidIfSharable(); + + /** @hide */ + public HidlSupport() {} } diff --git a/core/java/android/os/HwBinder.java b/core/java/android/os/HwBinder.java index 5e2a0815b60d..ecac002940cc 100644 --- a/core/java/android/os/HwBinder.java +++ b/core/java/android/os/HwBinder.java @@ -16,16 +16,20 @@ package android.os; +import android.annotation.SystemApi; + import libcore.util.NativeAllocationRegistry; import java.util.NoSuchElementException; /** @hide */ +@SystemApi public abstract class HwBinder implements IHwBinder { private static final String TAG = "HwBinder"; private static final NativeAllocationRegistry sNativeRegistry; + /** @hide */ public HwBinder() { native_setup(); @@ -34,33 +38,55 @@ public abstract class HwBinder implements IHwBinder { mNativeContext); } + /** @hide */ @Override public final native void transact( int code, HwParcel request, HwParcel reply, int flags) throws RemoteException; + /** @hide */ public abstract void onTransact( int code, HwParcel request, HwParcel reply, int flags) throws RemoteException; + /** @hide */ public native final void registerService(String serviceName) throws RemoteException; + /** @hide */ public static final IHwBinder getService( String iface, String serviceName) throws RemoteException, NoSuchElementException { return getService(iface, serviceName, false /* retry */); } + /** @hide */ public static native final IHwBinder getService( String iface, String serviceName, boolean retry) throws RemoteException, NoSuchElementException; + /** + * Configures how many threads the process-wide hwbinder threadpool + * has to process incoming requests. + * + * @hide + */ + @SystemApi public static native final void configureRpcThreadpool( long maxThreads, boolean callerWillJoin); + /** + * Current thread will join hwbinder threadpool and process + * commands in the pool. Should be called after configuring + * a threadpool with callerWillJoin true and then registering + * the provided service if this thread doesn't need to do + * anything else. + * + * @hide + */ + @SystemApi public static native final void joinRpcThreadpool(); // Returns address of the "freeFunction". @@ -83,6 +109,7 @@ public abstract class HwBinder implements IHwBinder { /** * Notifies listeners that a system property has changed + * @hide */ public static void reportSyspropChanged() { native_report_sysprop_change(); diff --git a/core/java/android/os/HwBlob.java b/core/java/android/os/HwBlob.java index 5e9b9ae3d49a..405651e992a3 100644 --- a/core/java/android/os/HwBlob.java +++ b/core/java/android/os/HwBlob.java @@ -17,10 +17,17 @@ package android.os; import android.annotation.NonNull; +import android.annotation.SystemApi; import libcore.util.NativeAllocationRegistry; -/** @hide */ +/** + * Represents fixed sized allocation of marshalled data used. Helper methods + * allow for access to the unmarshalled data in a variety of ways. + * + * @hide + */ +@SystemApi public class HwBlob { private static final String TAG = "HwBlob"; @@ -34,48 +41,276 @@ public class HwBlob { mNativeContext); } + /** + * @param offset offset to unmarshall a boolean from + * @return the unmarshalled boolean value + * @throws IndexOutOfBoundsException when offset is out of this HwBlob + */ public native final boolean getBool(long offset); + /** + * @param offset offset to unmarshall a byte from + * @return the unmarshalled byte value + * @throws IndexOutOfBoundsException when offset is out of this HwBlob + */ public native final byte getInt8(long offset); + /** + * @param offset offset to unmarshall a short from + * @return the unmarshalled short value + * @throws IndexOutOfBoundsException when offset is out of this HwBlob + */ public native final short getInt16(long offset); + /** + * @param offset offset to unmarshall an int from + * @return the unmarshalled int value + * @throws IndexOutOfBoundsException when offset is out of this HwBlob + */ public native final int getInt32(long offset); + /** + * @param offset offset to unmarshall a long from + * @return the unmarshalled long value + * @throws IndexOutOfBoundsException when offset is out of this HwBlob + */ public native final long getInt64(long offset); + /** + * @param offset offset to unmarshall a float from + * @return the unmarshalled float value + * @throws IndexOutOfBoundsException when offset is out of this HwBlob + */ public native final float getFloat(long offset); + /** + * @param offset offset to unmarshall a double from + * @return the unmarshalled double value + * @throws IndexOutOfBoundsException when offset is out of this HwBlob + */ public native final double getDouble(long offset); + /** + * @param offset offset to unmarshall a string from + * @return the unmarshalled string value + * @throws IndexOutOfBoundsException when offset is out of this HwBlob + */ public native final String getString(long offset); /** - The copyTo... methods copy the blob's data, starting from the given - byte offset, into the array. A total of "size" _elements_ are copied. + * Copy the blobs data starting from the given byte offset into the range, copying + * a total of size elements. + * + * @param offset starting location in blob + * @param array destination array + * @param size total number of elements to copy + * @throws IllegalArgumentException array.length < size + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jboolean)] out of the blob. */ public native final void copyToBoolArray(long offset, boolean[] array, int size); + /** + * Copy the blobs data starting from the given byte offset into the range, copying + * a total of size elements. + * + * @param offset starting location in blob + * @param array destination array + * @param size total number of elements to copy + * @throws IllegalArgumentException array.length < size + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jbyte)] out of the blob. + */ public native final void copyToInt8Array(long offset, byte[] array, int size); + /** + * Copy the blobs data starting from the given byte offset into the range, copying + * a total of size elements. + * + * @param offset starting location in blob + * @param array destination array + * @param size total number of elements to copy + * @throws IllegalArgumentException array.length < size + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jshort)] out of the blob. + */ public native final void copyToInt16Array(long offset, short[] array, int size); + /** + * Copy the blobs data starting from the given byte offset into the range, copying + * a total of size elements. + * + * @param offset starting location in blob + * @param array destination array + * @param size total number of elements to copy + * @throws IllegalArgumentException array.length < size + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jint)] out of the blob. + */ public native final void copyToInt32Array(long offset, int[] array, int size); + /** + * Copy the blobs data starting from the given byte offset into the range, copying + * a total of size elements. + * + * @param offset starting location in blob + * @param array destination array + * @param size total number of elements to copy + * @throws IllegalArgumentException array.length < size + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jlong)] out of the blob. + */ public native final void copyToInt64Array(long offset, long[] array, int size); + /** + * Copy the blobs data starting from the given byte offset into the range, copying + * a total of size elements. + * + * @param offset starting location in blob + * @param array destination array + * @param size total number of elements to copy + * @throws IllegalArgumentException array.length < size + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jfloat)] out of the blob. + */ public native final void copyToFloatArray(long offset, float[] array, int size); + /** + * Copy the blobs data starting from the given byte offset into the range, copying + * a total of size elements. + * + * @param offset starting location in blob + * @param array destination array + * @param size total number of elements to copy + * @throws IllegalArgumentException array.length < size + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jdouble)] out of the blob. + */ public native final void copyToDoubleArray(long offset, double[] array, int size); + /** + * Writes a boolean value at an offset. + * + * @param offset location to write value + * @param x value to write + * @throws IndexOutOfBoundsException when [offset, offset + sizeof(jboolean)] is out of range + */ public native final void putBool(long offset, boolean x); + /** + * Writes a byte value at an offset. + * + * @param offset location to write value + * @param x value to write + * @throws IndexOutOfBoundsException when [offset, offset + sizeof(jbyte)] is out of range + */ public native final void putInt8(long offset, byte x); + /** + * Writes a short value at an offset. + * + * @param offset location to write value + * @param x value to write + * @throws IndexOutOfBoundsException when [offset, offset + sizeof(jshort)] is out of range + */ public native final void putInt16(long offset, short x); + /** + * Writes a int value at an offset. + * + * @param offset location to write value + * @param x value to write + * @throws IndexOutOfBoundsException when [offset, offset + sizeof(jint)] is out of range + */ public native final void putInt32(long offset, int x); + /** + * Writes a long value at an offset. + * + * @param offset location to write value + * @param x value to write + * @throws IndexOutOfBoundsException when [offset, offset + sizeof(jlong)] is out of range + */ public native final void putInt64(long offset, long x); + /** + * Writes a float value at an offset. + * + * @param offset location to write value + * @param x value to write + * @throws IndexOutOfBoundsException when [offset, offset + sizeof(jfloat)] is out of range + */ public native final void putFloat(long offset, float x); + /** + * Writes a double value at an offset. + * + * @param offset location to write value + * @param x value to write + * @throws IndexOutOfBoundsException when [offset, offset + sizeof(jdouble)] is out of range + */ public native final void putDouble(long offset, double x); + /** + * Writes a string value at an offset. + * + * @param offset location to write value + * @param x value to write + * @throws IndexOutOfBoundsException when [offset, offset + sizeof(jstring)] is out of range + */ public native final void putString(long offset, String x); + /** + * Put a boolean array contiguously at an offset in the blob. + * + * @param offset location to write values + * @param x array to write + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jboolean)] out of the blob. + */ public native final void putBoolArray(long offset, boolean[] x); + /** + * Put a byte array contiguously at an offset in the blob. + * + * @param offset location to write values + * @param x array to write + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jbyte)] out of the blob. + */ public native final void putInt8Array(long offset, byte[] x); + /** + * Put a short array contiguously at an offset in the blob. + * + * @param offset location to write values + * @param x array to write + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jshort)] out of the blob. + */ public native final void putInt16Array(long offset, short[] x); + /** + * Put a int array contiguously at an offset in the blob. + * + * @param offset location to write values + * @param x array to write + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jint)] out of the blob. + */ public native final void putInt32Array(long offset, int[] x); + /** + * Put a long array contiguously at an offset in the blob. + * + * @param offset location to write values + * @param x array to write + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jlong)] out of the blob. + */ public native final void putInt64Array(long offset, long[] x); + /** + * Put a float array contiguously at an offset in the blob. + * + * @param offset location to write values + * @param x array to write + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jfloat)] out of the blob. + */ public native final void putFloatArray(long offset, float[] x); + /** + * Put a double array contiguously at an offset in the blob. + * + * @param offset location to write values + * @param x array to write + * @throws IndexOutOfBoundsException [offset, offset + size * sizeof(jdouble)] out of the blob. + */ public native final void putDoubleArray(long offset, double[] x); + /** + * Write another HwBlob into this blob at the specified location. + * + * @param offset location to write value + * @param blob data to write + * @throws IndexOutOfBoundsException if [offset, offset + blob's size] outside of the range of + * this blob. + */ public native final void putBlob(long offset, HwBlob blob); + /** + * @return current handle of HwBlob for reference in a parcelled binder transaction + */ public native final long handle(); + /** + * Convert a primitive to a wrapped array for boolean. + * + * @param array from array + * @return transformed array + */ public static Boolean[] wrapArray(@NonNull boolean[] array) { final int n = array.length; Boolean[] wrappedArray = new Boolean[n]; @@ -85,6 +320,12 @@ public class HwBlob { return wrappedArray; } + /** + * Convert a primitive to a wrapped array for long. + * + * @param array from array + * @return transformed array + */ public static Long[] wrapArray(@NonNull long[] array) { final int n = array.length; Long[] wrappedArray = new Long[n]; @@ -94,6 +335,12 @@ public class HwBlob { return wrappedArray; } + /** + * Convert a primitive to a wrapped array for byte. + * + * @param array from array + * @return transformed array + */ public static Byte[] wrapArray(@NonNull byte[] array) { final int n = array.length; Byte[] wrappedArray = new Byte[n]; @@ -103,6 +350,12 @@ public class HwBlob { return wrappedArray; } + /** + * Convert a primitive to a wrapped array for short. + * + * @param array from array + * @return transformed array + */ public static Short[] wrapArray(@NonNull short[] array) { final int n = array.length; Short[] wrappedArray = new Short[n]; @@ -112,6 +365,12 @@ public class HwBlob { return wrappedArray; } + /** + * Convert a primitive to a wrapped array for int. + * + * @param array from array + * @return transformed array + */ public static Integer[] wrapArray(@NonNull int[] array) { final int n = array.length; Integer[] wrappedArray = new Integer[n]; @@ -121,6 +380,12 @@ public class HwBlob { return wrappedArray; } + /** + * Convert a primitive to a wrapped array for float. + * + * @param array from array + * @return transformed array + */ public static Float[] wrapArray(@NonNull float[] array) { final int n = array.length; Float[] wrappedArray = new Float[n]; @@ -130,6 +395,12 @@ public class HwBlob { return wrappedArray; } + /** + * Convert a primitive to a wrapped array for double. + * + * @param array from array + * @return transformed array + */ public static Double[] wrapArray(@NonNull double[] array) { final int n = array.length; Double[] wrappedArray = new Double[n]; diff --git a/core/java/android/os/HwParcel.java b/core/java/android/os/HwParcel.java index 4ba1144742db..0eb62c95ed71 100644 --- a/core/java/android/os/HwParcel.java +++ b/core/java/android/os/HwParcel.java @@ -16,17 +16,32 @@ package android.os; -import java.util.ArrayList; -import java.util.Arrays; +import android.annotation.IntDef; +import android.annotation.SystemApi; import libcore.util.NativeAllocationRegistry; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.util.ArrayList; +import java.util.Arrays; + /** @hide */ +@SystemApi public class HwParcel { private static final String TAG = "HwParcel"; + @IntDef(prefix = { "STATUS_" }, value = { + STATUS_SUCCESS, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface Status {} + + /** + * Success return error for a transaction. Written to parcels + * using writeStatus. + */ public static final int STATUS_SUCCESS = 0; - public static final int STATUS_ERROR = -1; private static final NativeAllocationRegistry sNativeRegistry; @@ -38,6 +53,9 @@ public class HwParcel { mNativeContext); } + /** + * Creates an initialized and empty parcel. + */ public HwParcel() { native_setup(true /* allocate */); @@ -46,25 +64,106 @@ public class HwParcel { mNativeContext); } + /** + * Writes an interface token into the parcel used to verify that + * a transaction has made it to the write type of interface. + * + * @param interfaceName fully qualified name of interface message + * is being sent to. + */ public native final void writeInterfaceToken(String interfaceName); + /** + * Writes a boolean value to the end of the parcel. + * @param val to write + */ public native final void writeBool(boolean val); + /** + * Writes a byte value to the end of the parcel. + * @param val to write + */ public native final void writeInt8(byte val); + /** + * Writes a short value to the end of the parcel. + * @param val to write + */ public native final void writeInt16(short val); + /** + * Writes a int value to the end of the parcel. + * @param val to write + */ public native final void writeInt32(int val); + /** + * Writes a long value to the end of the parcel. + * @param val to write + */ public native final void writeInt64(long val); + /** + * Writes a float value to the end of the parcel. + * @param val to write + */ public native final void writeFloat(float val); + /** + * Writes a double value to the end of the parcel. + * @param val to write + */ public native final void writeDouble(double val); + /** + * Writes a String value to the end of the parcel. + * + * Note, this will be converted to UTF-8 when it is written. + * + * @param val to write + */ public native final void writeString(String val); + /** + * Writes an array of boolean values to the end of the parcel. + * @param val to write + */ private native final void writeBoolVector(boolean[] val); + /** + * Writes an array of byte values to the end of the parcel. + * @param val to write + */ private native final void writeInt8Vector(byte[] val); + /** + * Writes an array of short values to the end of the parcel. + * @param val to write + */ private native final void writeInt16Vector(short[] val); + /** + * Writes an array of int values to the end of the parcel. + * @param val to write + */ private native final void writeInt32Vector(int[] val); + /** + * Writes an array of long values to the end of the parcel. + * @param val to write + */ private native final void writeInt64Vector(long[] val); + /** + * Writes an array of float values to the end of the parcel. + * @param val to write + */ private native final void writeFloatVector(float[] val); + /** + * Writes an array of double values to the end of the parcel. + * @param val to write + */ private native final void writeDoubleVector(double[] val); + /** + * Writes an array of String values to the end of the parcel. + * + * Note, these will be converted to UTF-8 as they are written. + * + * @param val to write + */ private native final void writeStringVector(String[] val); + /** + * Helper method to write a list of Booleans to val. + * @param val list to write + */ public final void writeBoolVector(ArrayList<Boolean> val) { final int n = val.size(); boolean[] array = new boolean[n]; @@ -75,6 +174,10 @@ public class HwParcel { writeBoolVector(array); } + /** + * Helper method to write a list of Booleans to the end of the parcel. + * @param val list to write + */ public final void writeInt8Vector(ArrayList<Byte> val) { final int n = val.size(); byte[] array = new byte[n]; @@ -85,6 +188,10 @@ public class HwParcel { writeInt8Vector(array); } + /** + * Helper method to write a list of Shorts to the end of the parcel. + * @param val list to write + */ public final void writeInt16Vector(ArrayList<Short> val) { final int n = val.size(); short[] array = new short[n]; @@ -95,6 +202,10 @@ public class HwParcel { writeInt16Vector(array); } + /** + * Helper method to write a list of Integers to the end of the parcel. + * @param val list to write + */ public final void writeInt32Vector(ArrayList<Integer> val) { final int n = val.size(); int[] array = new int[n]; @@ -105,6 +216,10 @@ public class HwParcel { writeInt32Vector(array); } + /** + * Helper method to write a list of Longs to the end of the parcel. + * @param val list to write + */ public final void writeInt64Vector(ArrayList<Long> val) { final int n = val.size(); long[] array = new long[n]; @@ -115,6 +230,10 @@ public class HwParcel { writeInt64Vector(array); } + /** + * Helper method to write a list of Floats to the end of the parcel. + * @param val list to write + */ public final void writeFloatVector(ArrayList<Float> val) { final int n = val.size(); float[] array = new float[n]; @@ -125,6 +244,10 @@ public class HwParcel { writeFloatVector(array); } + /** + * Helper method to write a list of Doubles to the end of the parcel. + * @param val list to write + */ public final void writeDoubleVector(ArrayList<Double> val) { final int n = val.size(); double[] array = new double[n]; @@ -135,93 +258,272 @@ public class HwParcel { writeDoubleVector(array); } + /** + * Helper method to write a list of Strings to the end of the parcel. + * @param val list to write + */ public final void writeStringVector(ArrayList<String> val) { writeStringVector(val.toArray(new String[val.size()])); } + /** + * Write a hwbinder object to the end of the parcel. + * @param binder value to write + */ public native final void writeStrongBinder(IHwBinder binder); + /** + * Checks to make sure that the interface name matches the name written by the parcel + * sender by writeInterfaceToken + * + * @throws SecurityException interface doesn't match + */ public native final void enforceInterface(String interfaceName); + + /** + * Reads a boolean value from the current location in the parcel. + * @return value parsed from the parcel + * @throws IllegalArgumentException if the parcel has no more data + */ public native final boolean readBool(); + /** + * Reads a byte value from the current location in the parcel. + * @return value parsed from the parcel + * @throws IllegalArgumentException if the parcel has no more data + */ public native final byte readInt8(); + /** + * Reads a short value from the current location in the parcel. + * @return value parsed from the parcel + * @throws IllegalArgumentException if the parcel has no more data + */ public native final short readInt16(); + /** + * Reads a int value from the current location in the parcel. + * @return value parsed from the parcel + * @throws IllegalArgumentException if the parcel has no more data + */ public native final int readInt32(); + /** + * Reads a long value from the current location in the parcel. + * @return value parsed from the parcel + * @throws IllegalArgumentException if the parcel has no more data + */ public native final long readInt64(); + /** + * Reads a float value from the current location in the parcel. + * @return value parsed from the parcel + * @throws IllegalArgumentException if the parcel has no more data + */ public native final float readFloat(); + /** + * Reads a double value from the current location in the parcel. + * @return value parsed from the parcel + * @throws IllegalArgumentException if the parcel has no more data + */ public native final double readDouble(); + /** + * Reads a String value from the current location in the parcel. + * @return value parsed from the parcel + * @throws IllegalArgumentException if the parcel has no more data + */ public native final String readString(); + /** + * Reads an array of boolean values from the parcel. + * @return array of parsed values + * @throws IllegalArgumentException if the parcel has no more data + */ private native final boolean[] readBoolVectorAsArray(); + /** + * Reads an array of byte values from the parcel. + * @return array of parsed values + * @throws IllegalArgumentException if the parcel has no more data + */ private native final byte[] readInt8VectorAsArray(); + /** + * Reads an array of short values from the parcel. + * @return array of parsed values + * @throws IllegalArgumentException if the parcel has no more data + */ private native final short[] readInt16VectorAsArray(); + /** + * Reads an array of int values from the parcel. + * @return array of parsed values + * @throws IllegalArgumentException if the parcel has no more data + */ private native final int[] readInt32VectorAsArray(); + /** + * Reads an array of long values from the parcel. + * @return array of parsed values + * @throws IllegalArgumentException if the parcel has no more data + */ private native final long[] readInt64VectorAsArray(); + /** + * Reads an array of float values from the parcel. + * @return array of parsed values + * @throws IllegalArgumentException if the parcel has no more data + */ private native final float[] readFloatVectorAsArray(); + /** + * Reads an array of double values from the parcel. + * @return array of parsed values + * @throws IllegalArgumentException if the parcel has no more data + */ private native final double[] readDoubleVectorAsArray(); + /** + * Reads an array of String values from the parcel. + * @return array of parsed values + * @throws IllegalArgumentException if the parcel has no more data + */ private native final String[] readStringVectorAsArray(); + /** + * Convenience method to read a Boolean vector as an ArrayList. + * @return array of parsed values. + * @throws IllegalArgumentException if the parcel has no more data + */ public final ArrayList<Boolean> readBoolVector() { Boolean[] array = HwBlob.wrapArray(readBoolVectorAsArray()); return new ArrayList<Boolean>(Arrays.asList(array)); } + /** + * Convenience method to read a Byte vector as an ArrayList. + * @return array of parsed values. + * @throws IllegalArgumentException if the parcel has no more data + */ public final ArrayList<Byte> readInt8Vector() { Byte[] array = HwBlob.wrapArray(readInt8VectorAsArray()); return new ArrayList<Byte>(Arrays.asList(array)); } + /** + * Convenience method to read a Short vector as an ArrayList. + * @return array of parsed values. + * @throws IllegalArgumentException if the parcel has no more data + */ public final ArrayList<Short> readInt16Vector() { Short[] array = HwBlob.wrapArray(readInt16VectorAsArray()); return new ArrayList<Short>(Arrays.asList(array)); } + /** + * Convenience method to read a Integer vector as an ArrayList. + * @return array of parsed values. + * @throws IllegalArgumentException if the parcel has no more data + */ public final ArrayList<Integer> readInt32Vector() { Integer[] array = HwBlob.wrapArray(readInt32VectorAsArray()); return new ArrayList<Integer>(Arrays.asList(array)); } + /** + * Convenience method to read a Long vector as an ArrayList. + * @return array of parsed values. + * @throws IllegalArgumentException if the parcel has no more data + */ public final ArrayList<Long> readInt64Vector() { Long[] array = HwBlob.wrapArray(readInt64VectorAsArray()); return new ArrayList<Long>(Arrays.asList(array)); } + /** + * Convenience method to read a Float vector as an ArrayList. + * @return array of parsed values. + * @throws IllegalArgumentException if the parcel has no more data + */ public final ArrayList<Float> readFloatVector() { Float[] array = HwBlob.wrapArray(readFloatVectorAsArray()); return new ArrayList<Float>(Arrays.asList(array)); } + /** + * Convenience method to read a Double vector as an ArrayList. + * @return array of parsed values. + * @throws IllegalArgumentException if the parcel has no more data + */ public final ArrayList<Double> readDoubleVector() { Double[] array = HwBlob.wrapArray(readDoubleVectorAsArray()); return new ArrayList<Double>(Arrays.asList(array)); } + /** + * Convenience method to read a String vector as an ArrayList. + * @return array of parsed values. + * @throws IllegalArgumentException if the parcel has no more data + */ public final ArrayList<String> readStringVector() { return new ArrayList<String>(Arrays.asList(readStringVectorAsArray())); } + /** + * Reads a strong binder value from the parcel. + * @return binder object read from parcel or null if no binder can be read + * @throws IllegalArgumentException if the parcel has no more data + */ public native final IHwBinder readStrongBinder(); - // Handle is stored as part of the blob. + /** + * Read opaque segment of data as a blob. + * @return blob of size expectedSize + * @throws IllegalArgumentException if the parcel has no more data + */ public native final HwBlob readBuffer(long expectedSize); + /** + * Read a buffer written using scatter gather. + * + * @param expectedSize size that buffer should be + * @param parentHandle handle from which to read the embedded buffer + * @param offset offset into parent + * @param nullable whether or not to allow for a null return + * @return blob of data with size expectedSize + * @throws NoSuchElementException if an embedded buffer is not available to read + * @throws IllegalArgumentException if expectedSize < 0 + * @throws NullPointerException if the transaction specified the blob to be null + * but nullable is false + */ public native final HwBlob readEmbeddedBuffer( long expectedSize, long parentHandle, long offset, boolean nullable); + /** + * Write a buffer into the transaction. + * @param blob blob to write into the parcel. + */ public native final void writeBuffer(HwBlob blob); - + /** + * Write a status value into the blob. + * @param status value to write + */ public native final void writeStatus(int status); + /** + * @throws IllegalArgumentException if a success vaue cannot be read + * @throws RemoteException if success value indicates a transaction error + */ public native final void verifySuccess(); + /** + * Should be called to reduce memory pressure when this object no longer needs + * to be written to. + */ public native final void releaseTemporaryStorage(); + /** + * Should be called when object is no longer needed to reduce possible memory + * pressure if the Java GC does not get to this object in time. + */ public native final void release(); + /** + * Sends the parcel to the specified destination. + */ public native final void send(); // Returns address of the "freeFunction". diff --git a/core/java/android/os/IHwBinder.java b/core/java/android/os/IHwBinder.java index 619f4dc631d5..ce9f6c1654c2 100644 --- a/core/java/android/os/IHwBinder.java +++ b/core/java/android/os/IHwBinder.java @@ -16,26 +16,47 @@ package android.os; +import android.annotation.SystemApi; + /** @hide */ +@SystemApi public interface IHwBinder { // These MUST match their corresponding libhwbinder/IBinder.h definition !!! + /** @hide */ public static final int FIRST_CALL_TRANSACTION = 1; + /** @hide */ public static final int FLAG_ONEWAY = 1; + /** @hide */ public void transact( int code, HwParcel request, HwParcel reply, int flags) throws RemoteException; + /** @hide */ public IHwInterface queryLocalInterface(String descriptor); /** * Interface for receiving a callback when the process hosting a service * has gone away. */ + @SystemApi public interface DeathRecipient { + /** + * Callback for a registered process dying. + */ + @SystemApi public void serviceDied(long cookie); } + /** + * Notifies the death recipient with the cookie when the process containing + * this binder dies. + */ + @SystemApi public boolean linkToDeath(DeathRecipient recipient, long cookie); + /** + * Unregisters the death recipient from this binder. + */ + @SystemApi public boolean unlinkToDeath(DeathRecipient recipient); } diff --git a/core/java/android/os/IHwInterface.java b/core/java/android/os/IHwInterface.java index 7c5ac6f44a49..a2f59a9abb81 100644 --- a/core/java/android/os/IHwInterface.java +++ b/core/java/android/os/IHwInterface.java @@ -16,7 +16,13 @@ package android.os; +import android.annotation.SystemApi; /** @hide */ +@SystemApi public interface IHwInterface { + /** + * Returns the binder object that corresponds to an interface. + */ + @SystemApi public IHwBinder asBinder(); } diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index daf6bd571932..baa90e75d589 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -9335,13 +9335,52 @@ public final class Settings { public static final String RECOMMENDED_NETWORK_EVALUATOR_CACHE_EXPIRY_MS = "recommended_network_evaluator_cache_expiry_ms"; - /** + /** * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for * connectivity. * @hide */ - public static final String BLE_SCAN_ALWAYS_AVAILABLE = - "ble_scan_always_enabled"; + public static final String BLE_SCAN_ALWAYS_AVAILABLE = "ble_scan_always_enabled"; + + /** + * The length in milliseconds of a BLE scan window in a low-power scan mode. + * @hide + */ + public static final String BLE_SCAN_LOW_POWER_WINDOW_MS = "ble_scan_low_power_window_ms"; + + /** + * The length in milliseconds of a BLE scan window in a balanced scan mode. + * @hide + */ + public static final String BLE_SCAN_BALANCED_WINDOW_MS = "ble_scan_balanced_window_ms"; + + /** + * The length in milliseconds of a BLE scan window in a low-latency scan mode. + * @hide + */ + public static final String BLE_SCAN_LOW_LATENCY_WINDOW_MS = + "ble_scan_low_latency_window_ms"; + + /** + * The length in milliseconds of a BLE scan interval in a low-power scan mode. + * @hide + */ + public static final String BLE_SCAN_LOW_POWER_INTERVAL_MS = + "ble_scan_low_power_interval_ms"; + + /** + * The length in milliseconds of a BLE scan interval in a balanced scan mode. + * @hide + */ + public static final String BLE_SCAN_BALANCED_INTERVAL_MS = + "ble_scan_balanced_interval_ms"; + + /** + * The length in milliseconds of a BLE scan interval in a low-latency scan mode. + * @hide + */ + public static final String BLE_SCAN_LOW_LATENCY_INTERVAL_MS = + "ble_scan_low_latency_interval_ms"; /** * Used to save the Wifi_ON state prior to tethering. diff --git a/core/java/android/util/MutableBoolean.java b/core/java/android/util/MutableBoolean.java index ed837ab6afd3..44e73cc38b8f 100644 --- a/core/java/android/util/MutableBoolean.java +++ b/core/java/android/util/MutableBoolean.java @@ -17,7 +17,9 @@ package android.util; /** + * @deprecated This class will be removed from a future version of the Android API. */ +@Deprecated public final class MutableBoolean { public boolean value; diff --git a/core/java/android/util/MutableByte.java b/core/java/android/util/MutableByte.java index cc6b00a8046f..b9ec25dab2ad 100644 --- a/core/java/android/util/MutableByte.java +++ b/core/java/android/util/MutableByte.java @@ -17,7 +17,9 @@ package android.util; /** + * @deprecated This class will be removed from a future version of the Android API. */ +@Deprecated public final class MutableByte { public byte value; diff --git a/core/java/android/util/MutableChar.java b/core/java/android/util/MutableChar.java index 9a2e2bce5915..9f7a9ae82c32 100644 --- a/core/java/android/util/MutableChar.java +++ b/core/java/android/util/MutableChar.java @@ -17,7 +17,9 @@ package android.util; /** + * @deprecated This class will be removed from a future version of the Android API. */ +@Deprecated public final class MutableChar { public char value; diff --git a/core/java/android/util/MutableDouble.java b/core/java/android/util/MutableDouble.java index bd7329a380ee..56e539bc0f6f 100644 --- a/core/java/android/util/MutableDouble.java +++ b/core/java/android/util/MutableDouble.java @@ -17,7 +17,9 @@ package android.util; /** + * @deprecated This class will be removed from a future version of the Android API. */ +@Deprecated public final class MutableDouble { public double value; diff --git a/core/java/android/util/MutableFloat.java b/core/java/android/util/MutableFloat.java index e6f2d7dc7b30..6d7ad59d2473 100644 --- a/core/java/android/util/MutableFloat.java +++ b/core/java/android/util/MutableFloat.java @@ -17,7 +17,9 @@ package android.util; /** + * @deprecated This class will be removed from a future version of the Android API. */ +@Deprecated public final class MutableFloat { public float value; diff --git a/core/java/android/util/MutableInt.java b/core/java/android/util/MutableInt.java index a3d8606d916a..bb2456601be3 100644 --- a/core/java/android/util/MutableInt.java +++ b/core/java/android/util/MutableInt.java @@ -17,7 +17,9 @@ package android.util; /** + * @deprecated This class will be removed from a future version of the Android API. */ +@Deprecated public final class MutableInt { public int value; diff --git a/core/java/android/util/MutableLong.java b/core/java/android/util/MutableLong.java index 575068ea9364..86e70e1baebf 100644 --- a/core/java/android/util/MutableLong.java +++ b/core/java/android/util/MutableLong.java @@ -17,7 +17,9 @@ package android.util; /** + * @deprecated This class will be removed from a future version of the Android API. */ +@Deprecated public final class MutableLong { public long value; diff --git a/core/java/android/util/MutableShort.java b/core/java/android/util/MutableShort.java index 48fb232b5287..b94ab0732251 100644 --- a/core/java/android/util/MutableShort.java +++ b/core/java/android/util/MutableShort.java @@ -17,7 +17,9 @@ package android.util; /** + * @deprecated This class will be removed from a future version of the Android API. */ +@Deprecated public final class MutableShort { public short value; diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java index 08d023d03fc4..518a67657685 100644 --- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java +++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java @@ -114,6 +114,12 @@ public class SettingsBackupTest { Settings.Global.BATTERY_SAVER_DEVICE_SPECIFIC_CONSTANTS, Settings.Global.BATTERY_STATS_CONSTANTS, Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, + Settings.Global.BLE_SCAN_LOW_POWER_WINDOW_MS, + Settings.Global.BLE_SCAN_LOW_POWER_INTERVAL_MS, + Settings.Global.BLE_SCAN_BALANCED_WINDOW_MS, + Settings.Global.BLE_SCAN_BALANCED_INTERVAL_MS, + Settings.Global.BLE_SCAN_LOW_LATENCY_WINDOW_MS, + Settings.Global.BLE_SCAN_LOW_LATENCY_INTERVAL_MS, Settings.Global.BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX, Settings.Global.BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX, Settings.Global.BLUETOOTH_A2DP_SUPPORTS_OPTIONAL_CODECS_PREFIX, diff --git a/graphics/java/android/graphics/ImageDecoder.java b/graphics/java/android/graphics/ImageDecoder.java index 02d22bec5828..3de050b5ffa5 100644 --- a/graphics/java/android/graphics/ImageDecoder.java +++ b/graphics/java/android/graphics/ImageDecoder.java @@ -920,10 +920,6 @@ public final class ImageDecoder implements AutoCloseable { Resources res = src.getResources(); byte[] np = bm.getNinePatchChunk(); if (np != null && NinePatch.isNinePatchChunk(np)) { - if (res != null) { - bm.setDensity(res.getDisplayMetrics().densityDpi); - } - Rect opticalInsets = new Rect(); bm.getOpticalInsets(opticalInsets); Rect padding = new Rect(); diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index b9da6016acd6..fedd3d271be4 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -13268,6 +13268,9 @@ public class ActivityManagerService extends IActivityManager.Stub case ActivityManager.BUGREPORT_OPTION_TELEPHONY: extraOptions = "bugreporttelephony"; break; + case ActivityManager.BUGREPORT_OPTION_WIFI: + extraOptions = "bugreportwifi"; + break; default: throw new IllegalArgumentException("Provided bugreport type is not correct, value: " + bugreportType); @@ -13289,9 +13292,8 @@ public class ActivityManagerService extends IActivityManager.Stub * No new code should be calling it. */ @Deprecated - @Override - public void requestTelephonyBugReport(String shareTitle, String shareDescription) { - + private void requestBugReportWithDescription(String shareTitle, String shareDescription, + int bugreportType) { if (!TextUtils.isEmpty(shareTitle)) { if (shareTitle.length() > MAX_BUGREPORT_TITLE_SIZE) { String errorStr = "shareTitle should be less than " + @@ -13320,9 +13322,34 @@ public class ActivityManagerService extends IActivityManager.Stub Slog.d(TAG, "Bugreport notification title " + shareTitle + " description " + shareDescription); - requestBugReport(ActivityManager.BUGREPORT_OPTION_TELEPHONY); + requestBugReport(bugreportType); + } + + /** + * @deprecated This method is only used by a few internal components and it will soon be + * replaced by a proper bug report API (which will be restricted to a few, pre-defined apps). + * No new code should be calling it. + */ + @Deprecated + @Override + public void requestTelephonyBugReport(String shareTitle, String shareDescription) { + requestBugReportWithDescription(shareTitle, shareDescription, + ActivityManager.BUGREPORT_OPTION_TELEPHONY); + } + + /** + * @deprecated This method is only used by a few internal components and it will soon be + * replaced by a proper bug report API (which will be restricted to a few, pre-defined apps). + * No new code should be calling it. + */ + @Deprecated + @Override + public void requestWifiBugReport(String shareTitle, String shareDescription) { + requestBugReportWithDescription(shareTitle, shareDescription, + ActivityManager.BUGREPORT_OPTION_WIFI); } + public static long getInputDispatchingTimeoutLocked(ActivityRecord r) { return r != null ? getInputDispatchingTimeoutLocked(r.app) : KEY_DISPATCHING_TIMEOUT; } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 2bdbfdd1de04..0a6d960421b2 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -22,14 +22,13 @@ import android.annotation.IntDef; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; -import android.annotation.SuppressLint; import android.annotation.SdkConstant.SdkConstantType; +import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.WorkerThread; import android.app.ActivityThread; import android.app.PendingIntent; -import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; @@ -43,7 +42,6 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ServiceManager; import android.os.SystemProperties; -import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.service.carrier.CarrierIdentifier; import android.telecom.PhoneAccount; @@ -63,7 +61,6 @@ import com.android.internal.telephony.CellNetworkScanResult; import com.android.internal.telephony.IPhoneSubInfo; import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.ITelephonyRegistry; -import com.android.internal.telephony.OperatorInfo; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.TelephonyProperties; @@ -2601,6 +2598,53 @@ public class TelephonyManager { } } + /** + * Gets all the UICC slots. + * + * @return UiccSlotInfo array. + * + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + public UiccSlotInfo[] getUiccSlotsInfo() { + try { + ITelephony telephony = getITelephony(); + if (telephony == null) { + return null; + } + return telephony.getUiccSlotsInfo(); + } catch (RemoteException e) { + return null; + } + } + + /** + * Map logicalSlot to physicalSlot, and activate the physicalSlot if it is inactive. For + * example, passing the physicalSlots array [1, 0] means mapping the first item 1, which is + * physical slot index 1, to the logical slot 0; and mapping the second item 0, which is + * physical slot index 0, to the logical slot 1. The index of the array means the index of the + * logical slots. + * + * @param physicalSlots Index i in the array representing physical slot for phone i. The array + * size should be same as {@link #getPhoneCount()}. + * @return boolean Return true if the switch succeeds, false if the switch fails. + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public boolean switchSlots(int[] physicalSlots) { + try { + ITelephony telephony = getITelephony(); + if (telephony == null) { + return false; + } + return telephony.switchSlots(physicalSlots); + } catch (RemoteException e) { + return false; + } + } + // // // Subscriber Info diff --git a/telephony/java/android/telephony/UiccSlotInfo.aidl b/telephony/java/android/telephony/UiccSlotInfo.aidl new file mode 100644 index 000000000000..5571a6c35225 --- /dev/null +++ b/telephony/java/android/telephony/UiccSlotInfo.aidl @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +parcelable UiccSlotInfo; diff --git a/telephony/java/android/telephony/UiccSlotInfo.java b/telephony/java/android/telephony/UiccSlotInfo.java new file mode 100644 index 000000000000..0b3cbad0d2e2 --- /dev/null +++ b/telephony/java/android/telephony/UiccSlotInfo.java @@ -0,0 +1,158 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.telephony; + +import android.annotation.SystemApi; +import android.os.Parcel; +import android.os.Parcelable; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.util.Objects; + +import android.annotation.IntDef; + +/** + * Class for the information of a UICC slot. + * @hide + */ +@SystemApi +public class UiccSlotInfo implements Parcelable { + /** + * Card state. + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = { "CARD_STATE_INFO_" }, value = { + CARD_STATE_INFO_ABSENT, + CARD_STATE_INFO_PRESENT, + CARD_STATE_INFO_ERROR, + CARD_STATE_INFO_RESTRICTED + }) + public @interface CardStateInfo {} + + /** Card state absent. */ + public static final int CARD_STATE_INFO_ABSENT = 1; + + /** Card state present. */ + public static final int CARD_STATE_INFO_PRESENT = 2; + + /** Card state error. */ + public static final int CARD_STATE_INFO_ERROR = 3; + + /** Card state restricted. */ + public static final int CARD_STATE_INFO_RESTRICTED = 4; + + public final boolean isActive; + public final boolean isEuicc; + public final String cardId; + public final @CardStateInfo int cardStateInfo; + + public static final Creator<UiccSlotInfo> CREATOR = new Creator<UiccSlotInfo>() { + @Override + public UiccSlotInfo createFromParcel(Parcel in) { + return new UiccSlotInfo(in); + } + + @Override + public UiccSlotInfo[] newArray(int size) { + return new UiccSlotInfo[size]; + } + }; + + private UiccSlotInfo(Parcel in) { + isActive = in.readByte() != 0; + isEuicc = in.readByte() != 0; + cardId = in.readString(); + cardStateInfo = in.readInt(); + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeByte((byte) (isActive ? 1 : 0)); + dest.writeByte((byte) (isEuicc ? 1 : 0)); + dest.writeString(cardId); + dest.writeInt(cardStateInfo); + } + + @Override + public int describeContents() { + return 0; + } + + public UiccSlotInfo(boolean isActive, boolean isEuicc, String cardId, + @CardStateInfo int cardStateInfo) { + this.isActive = isActive; + this.isEuicc = isEuicc; + this.cardId = cardId; + this.cardStateInfo = cardStateInfo; + } + + public boolean getIsActive() { + return isActive; + } + + public boolean getIsEuicc() { + return isEuicc; + } + + public String getCardId() { + return cardId; + } + + @CardStateInfo + public int getCardStateInfo() { + return cardStateInfo; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + UiccSlotInfo that = (UiccSlotInfo) obj; + return (isActive == that.isActive) + && (isEuicc == that.isEuicc) + && (cardId == that.cardId) + && (cardStateInfo == that.cardStateInfo); + } + + @Override + public int hashCode() { + int result = 1; + result = 31 * result + (isActive ? 1 : 0); + result = 31 * result + (isEuicc ? 1 : 0); + result = 31 * result + Objects.hashCode(cardId); + result = 31 * result + cardStateInfo; + return result; + } + + @Override + public String toString() { + return "UiccSlotInfo (isActive=" + + isActive + + ", isEuicc=" + + isEuicc + + ", cardId=" + + cardId + + ", cardState=" + + cardStateInfo + + ")"; + } +} diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index fba82ee17f77..dfb3c344cb93 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -47,6 +47,7 @@ import com.android.internal.telephony.OperatorInfo; import java.util.List; +import android.telephony.UiccSlotInfo; /** * Interface used to interact with the phone. Mostly this is used by the @@ -1444,4 +1445,19 @@ interface ITelephony { * @hide */ SignalStrength getSignalStrength(int subId); + + /** + * Get slot info for all the UICC slots. + * @return UiccSlotInfo array. + * @hide + */ + UiccSlotInfo[] getUiccSlotsInfo(); + + /** + * Map logicalSlot to physicalSlot, and activate the physicalSlot if it is inactive. + * @param physicalSlots Index i in the array representing physical slot for phone i. The array + * size should be same as getPhoneCount(). + * @return boolean Return true if the switch succeeds, false if the switch fails. + */ + boolean switchSlots(in int[] physicalSlots); } |