Merge "Properly catch ServiceSpecificException if IMS isn't available"
diff --git a/api/current.txt b/api/current.txt
index a1cb0eb..55666f4 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -17964,6 +17964,7 @@
field public static final int RIGHT = 7; // 0x7
field public static final int TOP = 8; // 0x8
field public static final int TOP_AND_BOTTOM = 9; // 0x9
+ field public static final int TOP_AND_BOTTOM_AND_LEFT = 15; // 0xf
field public static final int TOP_AND_BOTTOM_AND_RIGHT = 10; // 0xa
field public static final int TOP_AND_LEFT = 11; // 0xb
field public static final int TOP_AND_LEFT_AND_RIGHT = 12; // 0xc
@@ -18286,6 +18287,7 @@
field public static final int CHEROKEE_SUPPLEMENT_ID = 255; // 0xff
field public static final android.icu.lang.UCharacter.UnicodeBlock CHESS_SYMBOLS;
field public static final int CHESS_SYMBOLS_ID = 281; // 0x119
+ field public static final int CHORASMIAN_ID = 301; // 0x12d
field public static final android.icu.lang.UCharacter.UnicodeBlock CJK_COMPATIBILITY;
field public static final android.icu.lang.UCharacter.UnicodeBlock CJK_COMPATIBILITY_FORMS;
field public static final int CJK_COMPATIBILITY_FORMS_ID = 83; // 0x53
@@ -18313,6 +18315,7 @@
field public static final int CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E_ID = 256; // 0x100
field public static final android.icu.lang.UCharacter.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F;
field public static final int CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F_ID = 274; // 0x112
+ field public static final int CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G_ID = 302; // 0x12e
field public static final int CJK_UNIFIED_IDEOGRAPHS_ID = 71; // 0x47
field public static final android.icu.lang.UCharacter.UnicodeBlock COMBINING_DIACRITICAL_MARKS;
field public static final android.icu.lang.UCharacter.UnicodeBlock COMBINING_DIACRITICAL_MARKS_EXTENDED;
@@ -18362,6 +18365,7 @@
field public static final int DEVANAGARI_ID = 15; // 0xf
field public static final android.icu.lang.UCharacter.UnicodeBlock DINGBATS;
field public static final int DINGBATS_ID = 56; // 0x38
+ field public static final int DIVES_AKURU_ID = 303; // 0x12f
field public static final android.icu.lang.UCharacter.UnicodeBlock DOGRA;
field public static final int DOGRA_ID = 282; // 0x11a
field public static final android.icu.lang.UCharacter.UnicodeBlock DOMINO_TILES;
@@ -18490,6 +18494,8 @@
field public static final int KAYAH_LI_ID = 162; // 0xa2
field public static final android.icu.lang.UCharacter.UnicodeBlock KHAROSHTHI;
field public static final int KHAROSHTHI_ID = 137; // 0x89
+ field public static final android.icu.lang.UCharacter.UnicodeBlock KHITAN_SMALL_SCRIPT;
+ field public static final int KHITAN_SMALL_SCRIPT_ID = 304; // 0x130
field public static final android.icu.lang.UCharacter.UnicodeBlock KHMER;
field public static final int KHMER_ID = 36; // 0x24
field public static final android.icu.lang.UCharacter.UnicodeBlock KHMER_SYMBOLS;
@@ -18528,6 +18534,8 @@
field public static final int LINEAR_B_SYLLABARY_ID = 117; // 0x75
field public static final android.icu.lang.UCharacter.UnicodeBlock LISU;
field public static final int LISU_ID = 176; // 0xb0
+ field public static final android.icu.lang.UCharacter.UnicodeBlock LISU_SUPPLEMENT;
+ field public static final int LISU_SUPPLEMENT_ID = 305; // 0x131
field public static final android.icu.lang.UCharacter.UnicodeBlock LOW_SURROGATES;
field public static final int LOW_SURROGATES_ID = 77; // 0x4d
field public static final android.icu.lang.UCharacter.UnicodeBlock LYCIAN;
@@ -18739,6 +18747,8 @@
field public static final int SYLOTI_NAGRI_ID = 143; // 0x8f
field public static final android.icu.lang.UCharacter.UnicodeBlock SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A;
field public static final int SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A_ID = 298; // 0x12a
+ field public static final android.icu.lang.UCharacter.UnicodeBlock SYMBOLS_FOR_LEGACY_COMPUTING;
+ field public static final int SYMBOLS_FOR_LEGACY_COMPUTING_ID = 306; // 0x132
field public static final android.icu.lang.UCharacter.UnicodeBlock SYRIAC;
field public static final int SYRIAC_ID = 13; // 0xd
field public static final android.icu.lang.UCharacter.UnicodeBlock SYRIAC_SUPPLEMENT;
@@ -18767,6 +18777,8 @@
field public static final android.icu.lang.UCharacter.UnicodeBlock TANGUT_COMPONENTS;
field public static final int TANGUT_COMPONENTS_ID = 273; // 0x111
field public static final int TANGUT_ID = 272; // 0x110
+ field public static final android.icu.lang.UCharacter.UnicodeBlock TANGUT_SUPPLEMENT;
+ field public static final int TANGUT_SUPPLEMENT_ID = 307; // 0x133
field public static final android.icu.lang.UCharacter.UnicodeBlock TELUGU;
field public static final int TELUGU_ID = 21; // 0x15
field public static final android.icu.lang.UCharacter.UnicodeBlock THAANA;
@@ -18801,6 +18813,8 @@
field public static final int WANCHO_ID = 300; // 0x12c
field public static final android.icu.lang.UCharacter.UnicodeBlock WARANG_CITI;
field public static final int WARANG_CITI_ID = 252; // 0xfc
+ field public static final android.icu.lang.UCharacter.UnicodeBlock YEZIDI;
+ field public static final int YEZIDI_ID = 308; // 0x134
field public static final android.icu.lang.UCharacter.UnicodeBlock YIJING_HEXAGRAM_SYMBOLS;
field public static final int YIJING_HEXAGRAM_SYMBOLS_ID = 116; // 0x74
field public static final android.icu.lang.UCharacter.UnicodeBlock YI_RADICALS;
@@ -19097,6 +19111,7 @@
field public static final int CHAKMA = 118; // 0x76
field public static final int CHAM = 66; // 0x42
field public static final int CHEROKEE = 6; // 0x6
+ field public static final int CHORASMIAN = 189; // 0xbd
field public static final int CIRTH = 67; // 0x43
field public static final int COMMON = 0; // 0x0
field public static final int COPTIC = 7; // 0x7
@@ -19106,6 +19121,7 @@
field public static final int DEMOTIC_EGYPTIAN = 69; // 0x45
field public static final int DESERET = 9; // 0x9
field public static final int DEVANAGARI = 10; // 0xa
+ field public static final int DIVES_AKURU = 190; // 0xbe
field public static final int DOGRA = 178; // 0xb2
field public static final int DUPLOYAN = 135; // 0x87
field public static final int EASTERN_SYRIAC = 97; // 0x61
@@ -19147,6 +19163,7 @@
field public static final int KATAKANA_OR_HIRAGANA = 54; // 0x36
field public static final int KAYAH_LI = 79; // 0x4f
field public static final int KHAROSHTHI = 57; // 0x39
+ field public static final int KHITAN_SMALL_SCRIPT = 191; // 0xbf
field public static final int KHMER = 23; // 0x17
field public static final int KHOJKI = 157; // 0x9d
field public static final int KHUDAWADI = 145; // 0x91
@@ -19264,6 +19281,7 @@
field public static final int WARANG_CITI = 146; // 0x92
field public static final int WESTERN_SYRIAC = 96; // 0x60
field public static final int WOLEAI = 155; // 0x9b
+ field public static final int YEZIDI = 192; // 0xc0
field public static final int YI = 41; // 0x29
field public static final int ZANABAZAR_SQUARE = 177; // 0xb1
}
@@ -44244,6 +44262,8 @@
package android.telephony {
public final class AccessNetworkConstants {
+ field public static final int TRANSPORT_TYPE_WLAN = 2; // 0x2
+ field public static final int TRANSPORT_TYPE_WWAN = 1; // 0x1
}
public static final class AccessNetworkConstants.AccessNetworkType {
@@ -44558,6 +44578,7 @@
field public static final String KEY_MMS_ALIAS_MIN_CHARS_INT = "aliasMinChars";
field public static final String KEY_MMS_ALLOW_ATTACH_AUDIO_BOOL = "allowAttachAudio";
field public static final String KEY_MMS_APPEND_TRANSACTION_ID_BOOL = "enabledTransID";
+ field public static final String KEY_MMS_CLOSE_CONNECTION_BOOL = "mmsCloseConnection";
field public static final String KEY_MMS_EMAIL_GATEWAY_NUMBER_STRING = "emailGatewayNumber";
field public static final String KEY_MMS_GROUP_MMS_ENABLED_BOOL = "enableGroupMms";
field public static final String KEY_MMS_HTTP_PARAMS_STRING = "httpParams";
@@ -44754,7 +44775,8 @@
method public int getCellConnectionStatus();
method @NonNull public abstract android.telephony.CellIdentity getCellIdentity();
method @NonNull public abstract android.telephony.CellSignalStrength getCellSignalStrength();
- method public long getTimeStamp();
+ method @Deprecated public long getTimeStamp();
+ method public long getTimestampNanos();
method public boolean isRegistered();
field public static final int CONNECTION_NONE = 0; // 0x0
field public static final int CONNECTION_PRIMARY_SERVING = 1; // 0x1
@@ -44989,6 +45011,35 @@
field @Deprecated public static final int UNKNOWN_RSSI = 99; // 0x63
}
+ public final class NetworkRegistrationInfo implements android.os.Parcelable {
+ method public int describeContents();
+ method public int getAccessNetworkTechnology();
+ method @NonNull public java.util.List<java.lang.Integer> getAvailableServices();
+ method @Nullable public android.telephony.CellIdentity getCellIdentity();
+ method public int getDomain();
+ method public int getNrState();
+ method public int getTransportType();
+ method public boolean isRegistered();
+ method public boolean isRoaming();
+ method public boolean isSearching();
+ method public void writeToParcel(android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationInfo> CREATOR;
+ field public static final int DOMAIN_CS = 1; // 0x1
+ field public static final int DOMAIN_CS_PS = 3; // 0x3
+ field public static final int DOMAIN_PS = 2; // 0x2
+ field public static final int DOMAIN_UNKNOWN = 0; // 0x0
+ field public static final int NR_STATE_CONNECTED = 3; // 0x3
+ field public static final int NR_STATE_NONE = 0; // 0x0
+ field public static final int NR_STATE_NOT_RESTRICTED = 2; // 0x2
+ field public static final int NR_STATE_RESTRICTED = 1; // 0x1
+ field public static final int SERVICE_TYPE_DATA = 2; // 0x2
+ field public static final int SERVICE_TYPE_EMERGENCY = 5; // 0x5
+ field public static final int SERVICE_TYPE_SMS = 3; // 0x3
+ field public static final int SERVICE_TYPE_UNKNOWN = 0; // 0x0
+ field public static final int SERVICE_TYPE_VIDEO = 4; // 0x4
+ field public static final int SERVICE_TYPE_VOICE = 1; // 0x1
+ }
+
public class NetworkScan {
method public void stopScan();
field public static final int ERROR_INTERRUPTED = 10002; // 0x2712
@@ -45161,6 +45212,7 @@
method public int getChannelNumber();
method public int getDuplexMode();
method public boolean getIsManualSelection();
+ method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoList();
method public String getOperatorAlphaLong();
method public String getOperatorAlphaShort();
method public String getOperatorNumeric();
@@ -45197,6 +45249,7 @@
method @Deprecated public int getGsmBitErrorRate();
method @Deprecated public int getGsmSignalStrength();
method public int getLevel();
+ method public long getTimestampNanos();
method @Deprecated public boolean isGsm();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SignalStrength> CREATOR;
@@ -70789,6 +70842,18 @@
method public int lastIndexOf(@Nullable Object);
method @NonNull public java.util.ListIterator<E> listIterator();
method @NonNull public java.util.ListIterator<E> listIterator(int);
+ method @NonNull public static <E> java.util.List<E> of();
+ method @NonNull public static <E> java.util.List<E> of(@NonNull E);
+ method @NonNull public static <E> java.util.List<E> of(@NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.List<E> of(@NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.List<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.List<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.List<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.List<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.List<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.List<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.List<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull @java.lang.SafeVarargs public static <E> java.util.List<E> of(@NonNull E...);
method public E remove(int);
method public default void replaceAll(@NonNull java.util.function.UnaryOperator<E>);
method public E set(int, E);
@@ -70943,6 +71008,7 @@
method @Nullable public default V computeIfPresent(K, @NonNull java.util.function.BiFunction<? super K,? super V,? extends V>);
method public boolean containsKey(@Nullable Object);
method public boolean containsValue(@Nullable Object);
+ method @NonNull public static <K, V> java.util.Map.Entry<K,V> entry(@NonNull K, @NonNull V);
method @NonNull public java.util.Set<java.util.Map.Entry<K,V>> entrySet();
method public boolean equals(@Nullable Object);
method public default void forEach(@NonNull java.util.function.BiConsumer<? super K,? super V>);
@@ -70952,6 +71018,18 @@
method public boolean isEmpty();
method @NonNull public java.util.Set<K> keySet();
method @Nullable public default V merge(K, @NonNull V, @NonNull java.util.function.BiFunction<? super V,? super V,? extends V>);
+ method @NonNull public static <K, V> java.util.Map<K,V> of();
+ method @NonNull public static <K, V> java.util.Map<K,V> of(@NonNull K, @NonNull V);
+ method @NonNull public static <K, V> java.util.Map<K,V> of(@NonNull K, @NonNull V, @NonNull K, @NonNull V);
+ method @NonNull public static <K, V> java.util.Map<K,V> of(@NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V);
+ method @NonNull public static <K, V> java.util.Map<K,V> of(@NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V);
+ method @NonNull public static <K, V> java.util.Map<K,V> of(@NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V);
+ method @NonNull public static <K, V> java.util.Map<K,V> of(@NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V);
+ method @NonNull public static <K, V> java.util.Map<K,V> of(@NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V);
+ method @NonNull public static <K, V> java.util.Map<K,V> of(@NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V);
+ method @NonNull public static <K, V> java.util.Map<K,V> of(@NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V);
+ method @NonNull public static <K, V> java.util.Map<K,V> of(@NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V, @NonNull K, @NonNull V);
+ method @NonNull @java.lang.SafeVarargs public static <K, V> java.util.Map<K,V> ofEntries(@NonNull java.util.Map.Entry<? extends K,? extends V>...);
method @Nullable public V put(K, V);
method public void putAll(@NonNull java.util.Map<? extends K,? extends V>);
method @Nullable public default V putIfAbsent(K, V);
@@ -71033,6 +71111,9 @@
}
public final class Objects {
+ method public static int checkFromIndexSize(int, int, int);
+ method public static int checkFromToIndex(int, int, int);
+ method public static int checkIndex(int, int);
method public static <T> int compare(T, T, @NonNull java.util.Comparator<? super T>);
method public static boolean deepEquals(@Nullable Object, @Nullable Object);
method public static boolean equals(@Nullable Object, @Nullable Object);
@@ -71043,6 +71124,8 @@
method @NonNull public static <T> T requireNonNull(@Nullable T);
method @NonNull public static <T> T requireNonNull(@Nullable T, @NonNull String);
method @NonNull public static <T> T requireNonNull(@Nullable T, @NonNull java.util.function.Supplier<java.lang.String>);
+ method @NonNull public static <T> T requireNonNullElse(@Nullable T, @NonNull T);
+ method @NonNull public static <T> T requireNonNullElseGet(@Nullable T, @NonNull java.util.function.Supplier<? extends T>);
method @NonNull public static String toString(@Nullable Object);
method @NonNull public static String toString(@Nullable Object, @NonNull String);
}
@@ -71347,6 +71430,18 @@
}
public interface Set<E> extends java.util.Collection<E> {
+ method @NonNull public static <E> java.util.Set<E> of();
+ method @NonNull public static <E> java.util.Set<E> of(@NonNull E);
+ method @NonNull public static <E> java.util.Set<E> of(@NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.Set<E> of(@NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.Set<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.Set<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.Set<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.Set<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.Set<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.Set<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull public static <E> java.util.Set<E> of(@NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E, @NonNull E);
+ method @NonNull @java.lang.SafeVarargs public static <E> java.util.Set<E> of(@NonNull E...);
}
public class SimpleTimeZone extends java.util.TimeZone {
diff --git a/api/lint-baseline.txt b/api/lint-baseline.txt
index 2720498..07106ba 100644
--- a/api/lint-baseline.txt
+++ b/api/lint-baseline.txt
@@ -489,6 +489,10 @@
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#ELYMAIC:
+MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#KHITAN_SMALL_SCRIPT:
+
+MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#LISU_SUPPLEMENT:
+
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#NANDINAGARI:
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#NYIAKENG_PUACHUE_HMONG:
@@ -499,22 +503,28 @@
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A:
+MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#SYMBOLS_FOR_LEGACY_COMPUTING:
+
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#TAMIL_SUPPLEMENT:
+MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#TANGUT_SUPPLEMENT:
+
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#WANCHO:
+MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#YEZIDI:
+
MissingNullability: android.icu.text.DateTimePatternGenerator#getFieldDisplayName(int, android.icu.text.DateTimePatternGenerator.DisplayWidth):
MissingNullability: android.icu.text.DateTimePatternGenerator#getFieldDisplayName(int, android.icu.text.DateTimePatternGenerator.DisplayWidth) parameter #1:
MissingNullability: android.icu.util.MeasureUnit#ATMOSPHERE:
- Missing nullability on field `ATMOSPHERE` in class `class android.icu.util.MeasureUnit`
+
MissingNullability: android.icu.util.MeasureUnit#PERCENT:
- Missing nullability on field `PERCENT` in class `class android.icu.util.MeasureUnit`
+
MissingNullability: android.icu.util.MeasureUnit#PERMILLE:
- Missing nullability on field `PERMILLE` in class `class android.icu.util.MeasureUnit`
+
MissingNullability: android.icu.util.MeasureUnit#PETABYTE:
- Missing nullability on field `PETABYTE` in class `class android.icu.util.MeasureUnit`
+
MissingNullability: android.icu.util.VersionInfo#UNICODE_12_0:
MissingNullability: android.icu.util.VersionInfo#UNICODE_12_1:
diff --git a/api/system-current.txt b/api/system-current.txt
index 33946ea1..998846a 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4640,15 +4640,6 @@
method @NonNull public android.net.StaticIpConfiguration.Builder setIpAddress(@Nullable android.net.LinkAddress);
}
- public final class StringNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable {
- ctor public StringNetworkSpecifier(@NonNull String);
- method public int describeContents();
- method public boolean satisfiedBy(android.net.NetworkSpecifier);
- method public void writeToParcel(@NonNull android.os.Parcel, int);
- field @NonNull public static final android.os.Parcelable.Creator<android.net.StringNetworkSpecifier> CREATOR;
- field @NonNull public final String specifier;
- }
-
public final class TelephonyNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable {
method public boolean satisfiedBy(android.net.NetworkSpecifier);
}
@@ -8114,8 +8105,6 @@
public final class AccessNetworkConstants {
field public static final int TRANSPORT_TYPE_INVALID = -1; // 0xffffffff
- field public static final int TRANSPORT_TYPE_WLAN = 2; // 0x2
- field public static final int TRANSPORT_TYPE_WWAN = 1; // 0x1
}
public final class CallAttributes implements android.os.Parcelable {
@@ -8743,37 +8732,18 @@
}
public final class NetworkRegistrationInfo implements android.os.Parcelable {
- method public int describeContents();
- method public int getAccessNetworkTechnology();
- method @NonNull public java.util.List<java.lang.Integer> getAvailableServices();
- method @Nullable public android.telephony.CellIdentity getCellIdentity();
method @Nullable public android.telephony.DataSpecificRegistrationInfo getDataSpecificInfo();
- method public int getDomain();
- method public int getNrState();
method public int getRegistrationState();
method public int getRejectCause();
method public int getRoamingType();
- method public int getTransportType();
method public boolean isEmergencyEnabled();
- method public boolean isRoaming();
method public void writeToParcel(android.os.Parcel, int);
- field @NonNull public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationInfo> CREATOR;
- field public static final int DOMAIN_CS = 1; // 0x1
- field public static final int DOMAIN_CS_PS = 3; // 0x3
- field public static final int DOMAIN_PS = 2; // 0x2
- field public static final int DOMAIN_UNKNOWN = 0; // 0x0
field public static final int REGISTRATION_STATE_DENIED = 3; // 0x3
field public static final int REGISTRATION_STATE_HOME = 1; // 0x1
field public static final int REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING = 0; // 0x0
field public static final int REGISTRATION_STATE_NOT_REGISTERED_SEARCHING = 2; // 0x2
field public static final int REGISTRATION_STATE_ROAMING = 5; // 0x5
field public static final int REGISTRATION_STATE_UNKNOWN = 4; // 0x4
- field public static final int SERVICE_TYPE_DATA = 2; // 0x2
- field public static final int SERVICE_TYPE_EMERGENCY = 5; // 0x5
- field public static final int SERVICE_TYPE_SMS = 3; // 0x3
- field public static final int SERVICE_TYPE_UNKNOWN = 0; // 0x0
- field public static final int SERVICE_TYPE_VIDEO = 4; // 0x4
- field public static final int SERVICE_TYPE_VOICE = 1; // 0x1
}
public static final class NetworkRegistrationInfo.Builder {
@@ -8878,6 +8848,7 @@
}
public final class PreciseDataConnectionState implements android.os.Parcelable {
+ ctor public PreciseDataConnectionState(int, int, int, @NonNull String, @Nullable android.net.LinkProperties, int, @Nullable android.telephony.data.ApnSetting);
method @Deprecated @NonNull public String getDataConnectionApn();
method @Deprecated public int getDataConnectionApnTypeBitMask();
method @Deprecated public int getDataConnectionFailCause();
@@ -8989,7 +8960,6 @@
method public int getDataNetworkType();
method public int getDataRegistrationState();
method @Nullable public android.telephony.NetworkRegistrationInfo getNetworkRegistrationInfo(int, int);
- method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoList();
method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoListForDomain(int);
method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoListForTransportType(int);
method public int getNrFrequencyRange();
@@ -9002,6 +8972,10 @@
field public static final int ROAMING_TYPE_UNKNOWN = 1; // 0x1
}
+ public class SignalStrength implements android.os.Parcelable {
+ ctor public SignalStrength(@NonNull android.telephony.SignalStrength);
+ }
+
public final class SmsCbCmasInfo implements android.os.Parcelable {
ctor public SmsCbCmasInfo(int, int, int, int, int, int);
method public int describeContents();
@@ -9319,6 +9293,9 @@
field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED";
field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED";
field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED";
+ field public static final int CARD_POWER_DOWN = 0; // 0x0
+ field public static final int CARD_POWER_UP = 1; // 0x1
+ field public static final int CARD_POWER_UP_PASS_THROUGH = 2; // 0x2
field public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; // 0xfffffffe
field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1
field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0
@@ -10327,6 +10304,7 @@
public abstract class ImsFeature {
ctor public ImsFeature();
method public abstract void changeEnabledCapabilities(android.telephony.ims.feature.CapabilityChangeRequest, android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy);
+ method public int getFeatureState();
method public final int getSlotIndex();
method public abstract void onFeatureReady();
method public abstract void onFeatureRemoved();
@@ -10574,6 +10552,17 @@
method public int updateClir(int);
method public int updateColp(boolean);
method public int updateColr(int);
+ field public static final int CALL_BARRING_ALL = 7; // 0x7
+ field public static final int CALL_BARRING_ALL_INCOMING = 1; // 0x1
+ field public static final int CALL_BARRING_ALL_OUTGOING = 2; // 0x2
+ field public static final int CALL_BARRING_ANONYMOUS_INCOMING = 6; // 0x6
+ field public static final int CALL_BARRING_INCOMING_ALL_SERVICES = 9; // 0x9
+ field public static final int CALL_BARRING_OUTGOING_ALL_SERVICES = 8; // 0x8
+ field public static final int CALL_BARRING_OUTGOING_INTL = 3; // 0x3
+ field public static final int CALL_BARRING_OUTGOING_INTL_EXCL_HOME = 4; // 0x4
+ field public static final int CALL_BARRING_SPECIFIC_INCOMING_CALLS = 10; // 0xa
+ field public static final int CALL_BLOCKING_INCOMING_WHEN_ROAMING = 5; // 0x5
+ field public static final int INVALID_RESULT = -1; // 0xffffffff
}
}
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 5802f6c..57ee408 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -130,6 +130,18 @@
}
+package android.net {
+
+ @Deprecated public final class StringNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable {
+ ctor public StringNetworkSpecifier(@NonNull String);
+ method public int describeContents();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.net.StringNetworkSpecifier> CREATOR;
+ field @NonNull public final String specifier;
+ }
+
+}
+
package android.net.wifi {
@Deprecated public class BatchedScanResult implements android.os.Parcelable {
diff --git a/api/test-current.txt b/api/test-current.txt
index 2a4af61..f438d55 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -2888,8 +2888,6 @@
public final class AccessNetworkConstants {
field public static final int TRANSPORT_TYPE_INVALID = -1; // 0xffffffff
- field public static final int TRANSPORT_TYPE_WLAN = 2; // 0x2
- field public static final int TRANSPORT_TYPE_WWAN = 1; // 0x1
}
public final class CallQuality implements android.os.Parcelable {
@@ -2952,36 +2950,18 @@
}
public final class NetworkRegistrationInfo implements android.os.Parcelable {
- method public int describeContents();
- method public int getAccessNetworkTechnology();
- method @NonNull public java.util.List<java.lang.Integer> getAvailableServices();
- method @Nullable public android.telephony.CellIdentity getCellIdentity();
method @Nullable public android.telephony.DataSpecificRegistrationInfo getDataSpecificInfo();
- method public int getDomain();
method public int getRegistrationState();
method public int getRejectCause();
method public int getRoamingType();
- method public int getTransportType();
method public boolean isEmergencyEnabled();
- method public boolean isRoaming();
method public void writeToParcel(android.os.Parcel, int);
- field @NonNull public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationInfo> CREATOR;
- field public static final int DOMAIN_CS = 1; // 0x1
- field public static final int DOMAIN_CS_PS = 3; // 0x3
- field public static final int DOMAIN_PS = 2; // 0x2
- field public static final int DOMAIN_UNKNOWN = 0; // 0x0
field public static final int REGISTRATION_STATE_DENIED = 3; // 0x3
field public static final int REGISTRATION_STATE_HOME = 1; // 0x1
field public static final int REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING = 0; // 0x0
field public static final int REGISTRATION_STATE_NOT_REGISTERED_SEARCHING = 2; // 0x2
field public static final int REGISTRATION_STATE_ROAMING = 5; // 0x5
field public static final int REGISTRATION_STATE_UNKNOWN = 4; // 0x4
- field public static final int SERVICE_TYPE_DATA = 2; // 0x2
- field public static final int SERVICE_TYPE_EMERGENCY = 5; // 0x5
- field public static final int SERVICE_TYPE_SMS = 3; // 0x3
- field public static final int SERVICE_TYPE_UNKNOWN = 0; // 0x0
- field public static final int SERVICE_TYPE_VIDEO = 4; // 0x4
- field public static final int SERVICE_TYPE_VOICE = 1; // 0x1
}
public static final class NetworkRegistrationInfo.Builder {
@@ -3657,6 +3637,7 @@
public abstract class ImsFeature {
ctor public ImsFeature();
method public abstract void changeEnabledCapabilities(android.telephony.ims.feature.CapabilityChangeRequest, android.telephony.ims.feature.ImsFeature.CapabilityCallbackProxy);
+ method public int getFeatureState();
method public final int getSlotIndex();
method public abstract void onFeatureReady();
method public abstract void onFeatureRemoved();
@@ -3904,6 +3885,17 @@
method public int updateClir(int);
method public int updateColp(boolean);
method public int updateColr(int);
+ field public static final int CALL_BARRING_ALL = 7; // 0x7
+ field public static final int CALL_BARRING_ALL_INCOMING = 1; // 0x1
+ field public static final int CALL_BARRING_ALL_OUTGOING = 2; // 0x2
+ field public static final int CALL_BARRING_ANONYMOUS_INCOMING = 6; // 0x6
+ field public static final int CALL_BARRING_INCOMING_ALL_SERVICES = 9; // 0x9
+ field public static final int CALL_BARRING_OUTGOING_ALL_SERVICES = 8; // 0x8
+ field public static final int CALL_BARRING_OUTGOING_INTL = 3; // 0x3
+ field public static final int CALL_BARRING_OUTGOING_INTL_EXCL_HOME = 4; // 0x4
+ field public static final int CALL_BARRING_SPECIFIC_INCOMING_CALLS = 10; // 0xa
+ field public static final int CALL_BLOCKING_INCOMING_WHEN_ROAMING = 5; // 0x5
+ field public static final int INVALID_RESULT = -1; // 0xffffffff
}
}
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java
index 6033655..c2ee6dc 100644
--- a/cmds/sm/src/com/android/commands/sm/Sm.java
+++ b/cmds/sm/src/com/android/commands/sm/Sm.java
@@ -103,6 +103,10 @@
runSetVirtualDisk();
} else if ("set-isolated-storage".equals(op)) {
runIsolatedStorage();
+ } else if ("start-checkpoint".equals(op)) {
+ runStartCheckpoint();
+ } else if ("supports-checkpoint".equals(op)) {
+ runSupportsCheckpoint();
} else {
throw new IllegalArgumentException();
}
@@ -313,6 +317,27 @@
}
}
+ private void runStartCheckpoint() throws RemoteException {
+ final String numRetriesString = nextArg();
+ if (numRetriesString == null) {
+ throw new IllegalArgumentException("Expected <num-retries>");
+ }
+ int numRetries;
+ try {
+ numRetries = Integer.parseInt(numRetriesString);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("<num-retries> must be a positive integer");
+ }
+ if (numRetries <= 0) {
+ throw new IllegalArgumentException("<num-retries> must be a positive integer");
+ }
+ mSm.startCheckpoint(numRetries);
+ }
+
+ private void runSupportsCheckpoint() throws RemoteException {
+ System.out.println(mSm.supportsCheckpoint());
+ }
+
private String nextArg() {
if (mNextArg >= mArgs.length) {
return null;
@@ -344,6 +369,10 @@
System.err.println("");
System.err.println(" sm set-isolated-storage [on|off|default]");
System.err.println("");
+ System.err.println(" sm start-checkpoint <num-retries>");
+ System.err.println("");
+ System.err.println(" sm supports-checkpoint");
+ System.err.println("");
return 1;
}
}
diff --git a/core/java/android/net/StringNetworkSpecifier.java b/core/java/android/net/StringNetworkSpecifier.java
index 83dbc63..530c84a 100644
--- a/core/java/android/net/StringNetworkSpecifier.java
+++ b/core/java/android/net/StringNetworkSpecifier.java
@@ -26,7 +26,16 @@
import java.util.Objects;
-/** @hide */
+/**
+ * @deprecated use other subclass of {@link android.net.NetworkSpecifier},
+ * eg. {@link android.net.TelephonyNetworkSpecifier},
+ * {@link android.net.wifi.WifiNetworkSpecifier} instead.
+ * @see {@link android.net.NetworkRequest#setNetworkSpecifier(String)} for details.
+ * @removed this class was tentatively made SystemApi in December 2019 in the scramble for
+ * publishing mainline APIs, it should be removed before R release is published.
+ * @hide
+ */
+@Deprecated
@SystemApi
public final class StringNetworkSpecifier extends NetworkSpecifier implements Parcelable {
/**
diff --git a/core/java/android/os/IVibratorService.aidl b/core/java/android/os/IVibratorService.aidl
index 6b881fe..264ab60 100644
--- a/core/java/android/os/IVibratorService.aidl
+++ b/core/java/android/os/IVibratorService.aidl
@@ -24,7 +24,8 @@
{
boolean hasVibrator();
boolean hasAmplitudeControl();
- boolean setAlwaysOnEffect(int id, in VibrationEffect effect, in AudioAttributes attributes);
+ boolean setAlwaysOnEffect(int uid, String opPkg, int alwaysOnId, in VibrationEffect effect,
+ in AudioAttributes attributes);
void vibrate(int uid, String opPkg, in VibrationEffect effect, in AudioAttributes attributes,
String reason, IBinder token);
void cancelVibrate(IBinder token);
diff --git a/core/java/android/os/SystemVibrator.java b/core/java/android/os/SystemVibrator.java
index f585c75..11a425d 100644
--- a/core/java/android/os/SystemVibrator.java
+++ b/core/java/android/os/SystemVibrator.java
@@ -70,13 +70,14 @@
}
@Override
- public boolean setAlwaysOnEffect(int id, VibrationEffect effect, AudioAttributes attributes) {
+ public boolean setAlwaysOnEffect(int uid, String opPkg, int alwaysOnId, VibrationEffect effect,
+ AudioAttributes attributes) {
if (mService == null) {
Log.w(TAG, "Failed to set always-on effect; no vibrator service.");
return false;
}
try {
- return mService.setAlwaysOnEffect(id, effect, attributes);
+ return mService.setAlwaysOnEffect(uid, opPkg, alwaysOnId, effect, attributes);
} catch (RemoteException e) {
Log.w(TAG, "Failed to set always-on effect.", e);
}
diff --git a/core/java/android/os/Vibrator.java b/core/java/android/os/Vibrator.java
index ccbb0f1..ae75f3d 100644
--- a/core/java/android/os/Vibrator.java
+++ b/core/java/android/os/Vibrator.java
@@ -155,7 +155,7 @@
/**
* Configure an always-on haptics effect.
*
- * @param id The board-specific always-on ID to configure.
+ * @param alwaysOnId The board-specific always-on ID to configure.
* @param effect Vibration effect to assign to always-on id. Passing null will disable it.
* @param attributes {@link AudioAttributes} corresponding to the vibration. For example,
* specify {@link AudioAttributes#USAGE_ALARM} for alarm vibrations or
@@ -164,8 +164,17 @@
* @hide
*/
@RequiresPermission(android.Manifest.permission.VIBRATE_ALWAYS_ON)
- public boolean setAlwaysOnEffect(int id, @Nullable VibrationEffect effect,
- @Nullable AudioAttributes attributes) {
+ public boolean setAlwaysOnEffect(int alwaysOnId, @Nullable VibrationEffect effect,
+ @Nullable AudioAttributes attributes) {
+ return setAlwaysOnEffect(Process.myUid(), mPackageName, alwaysOnId, effect, attributes);
+ }
+
+ /**
+ * @hide
+ */
+ @RequiresPermission(android.Manifest.permission.VIBRATE_ALWAYS_ON)
+ public boolean setAlwaysOnEffect(int uid, String opPkg, int alwaysOnId,
+ @Nullable VibrationEffect effect, @Nullable AudioAttributes attributes) {
Log.w(TAG, "Always-on effects aren't supported");
return false;
}
diff --git a/core/java/android/os/image/DynamicSystemClient.java b/core/java/android/os/image/DynamicSystemClient.java
index 921f0f2..5cb3361 100644
--- a/core/java/android/os/image/DynamicSystemClient.java
+++ b/core/java/android/os/image/DynamicSystemClient.java
@@ -256,9 +256,13 @@
mService.send(msg);
} catch (RemoteException e) {
Slog.e(TAG, "Unable to get status from installation service");
- mExecutor.execute(() -> {
+ if (mExecutor != null) {
+ mExecutor.execute(() -> {
+ mListener.onStatusChanged(STATUS_UNKNOWN, CAUSE_ERROR_IPC, 0, e);
+ });
+ } else {
mListener.onStatusChanged(STATUS_UNKNOWN, CAUSE_ERROR_IPC, 0, e);
- });
+ }
}
}
diff --git a/core/java/android/os/image/DynamicSystemManager.java b/core/java/android/os/image/DynamicSystemManager.java
index 4c92c28..cbf531c 100644
--- a/core/java/android/os/image/DynamicSystemManager.java
+++ b/core/java/android/os/image/DynamicSystemManager.java
@@ -106,9 +106,9 @@
* @return true if the call succeeds
*/
@RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
- public boolean startInstallation() {
+ public boolean startInstallation(String dsuSlot) {
try {
- return mService.startInstallation();
+ return mService.startInstallation(dsuSlot);
} catch (RemoteException e) {
throw new RuntimeException(e.toString());
}
diff --git a/core/java/android/os/image/IDynamicSystemService.aidl b/core/java/android/os/image/IDynamicSystemService.aidl
index 69cbab2..cc32f99 100644
--- a/core/java/android/os/image/IDynamicSystemService.aidl
+++ b/core/java/android/os/image/IDynamicSystemService.aidl
@@ -22,9 +22,10 @@
{
/**
* Start DynamicSystem installation.
+ * @param dsuSlot Name used to identify this installation
* @return true if the call succeeds
*/
- boolean startInstallation();
+ boolean startInstallation(@utf8InCpp String dsuSlot);
/**
* Create a DSU partition. This call may take 60~90 seconds. The caller
diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java
index 179828c..13d0c5c 100644
--- a/core/java/com/android/internal/os/RuntimeInit.java
+++ b/core/java/com/android/internal/os/RuntimeInit.java
@@ -35,6 +35,7 @@
import com.android.server.NetworkManagementSocketTagger;
import dalvik.system.RuntimeHooks;
+import dalvik.system.ThreadPrioritySetter;
import dalvik.system.VMRuntime;
import libcore.content.type.MimeMap;
@@ -204,6 +205,7 @@
*/
public static void preForkInit() {
if (DEBUG) Slog.d(TAG, "Entered preForkInit.");
+ RuntimeHooks.setThreadPrioritySetter(new RuntimeThreadPrioritySetter());
RuntimeInit.enableDdms();
// TODO(b/142019040#comment13): Decide whether to load the default instance eagerly, i.e.
// MimeMap.setDefault(DefaultMimeMapFactory.create());
@@ -216,6 +218,35 @@
MimeMap.setDefaultSupplier(DefaultMimeMapFactory::create);
}
+ private static class RuntimeThreadPrioritySetter implements ThreadPrioritySetter {
+ // Should remain consistent with kNiceValues[] in system/libartpalette/palette_android.cc
+ private static final int[] NICE_VALUES = {
+ Process.THREAD_PRIORITY_LOWEST, // 1 (MIN_PRIORITY)
+ Process.THREAD_PRIORITY_BACKGROUND + 6,
+ Process.THREAD_PRIORITY_BACKGROUND + 3,
+ Process.THREAD_PRIORITY_BACKGROUND,
+ Process.THREAD_PRIORITY_DEFAULT, // 5 (NORM_PRIORITY)
+ Process.THREAD_PRIORITY_DEFAULT - 2,
+ Process.THREAD_PRIORITY_DEFAULT - 4,
+ Process.THREAD_PRIORITY_URGENT_DISPLAY + 3,
+ Process.THREAD_PRIORITY_URGENT_DISPLAY + 2,
+ Process.THREAD_PRIORITY_URGENT_DISPLAY // 10 (MAX_PRIORITY)
+ };
+
+ @Override
+ public void setPriority(int nativeTid, int priority) {
+ // Check NICE_VALUES[] length first.
+ if (NICE_VALUES.length != (1 + Thread.MAX_PRIORITY - Thread.MIN_PRIORITY)) {
+ throw new AssertionError("Unexpected NICE_VALUES.length=" + NICE_VALUES.length);
+ }
+ // Priority should be in the range of MIN_PRIORITY (1) to MAX_PRIORITY (10).
+ if (priority < Thread.MIN_PRIORITY || priority > Thread.MAX_PRIORITY) {
+ throw new IllegalArgumentException("Priority out of range: " + priority);
+ }
+ Process.setThreadPriority(nativeTid, NICE_VALUES[priority - Thread.MIN_PRIORITY]);
+ }
+ }
+
@UnsupportedAppUsage
protected static final void commonInit() {
if (DEBUG) Slog.d(TAG, "Entered RuntimeInit!");
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 33adec1..fd9f025 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -49,9 +49,9 @@
/** @hide */
public final class Zygote {
/*
- * Bit values for "runtimeFlags" argument. The definitions are duplicated
- * in the native code.
- */
+ * Bit values for "runtimeFlags" argument. The definitions are duplicated
+ * in the native code.
+ */
/** enable debugging over JDWP */
public static final int DEBUG_ENABLE_JDWP = 1;
@@ -187,6 +187,11 @@
*/
public static final int SOCKET_BUFFER_SIZE = 256;
+ /**
+ * @hide for internal use only
+ */
+ private static final int PRIORITY_MAX = -20;
+
/** a prototype instance for a future List.toArray() */
protected static final int[][] INT_ARRAY_2D = new int[0][0];
@@ -251,8 +256,7 @@
int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir,
int targetSdkVersion) {
ZygoteHooks.preFork();
- // Resets nice priority for zygote process.
- resetNicePriority();
+
int pid = nativeForkAndSpecialize(
uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, fdsToClose,
fdsToIgnore, startChildZygote, instructionSet, appDataDir);
@@ -264,6 +268,10 @@
// Note that this event ends at the end of handleChildProc,
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork");
}
+
+ // Set the Java Language thread priority to the default value for new apps.
+ Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
+
ZygoteHooks.postForkCommon();
return pid;
}
@@ -298,7 +306,7 @@
int[][] rlimits, int mountExternal, String seInfo, String niceName,
boolean startChildZygote, String instructionSet, String appDataDir) {
nativeSpecializeAppProcess(uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo,
- niceName, startChildZygote, instructionSet, appDataDir);
+ niceName, startChildZygote, instructionSet, appDataDir);
// Enable tracing as soon as possible for the child process.
Trace.setTracingEnabled(true, runtimeFlags);
@@ -306,6 +314,9 @@
// Note that this event ends at the end of handleChildProc.
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork");
+ // Set the Java Language thread priority to the default value for new apps.
+ Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
+
/*
* This is called here (instead of after the fork but before the specialize) to maintain
* consistancy with the code paths for forkAndSpecialize.
@@ -350,15 +361,19 @@
public static int forkSystemServer(int uid, int gid, int[] gids, int runtimeFlags,
int[][] rlimits, long permittedCapabilities, long effectiveCapabilities) {
ZygoteHooks.preFork();
- // Resets nice priority for zygote process.
- resetNicePriority();
+
int pid = nativeForkSystemServer(
uid, gid, gids, runtimeFlags, rlimits,
permittedCapabilities, effectiveCapabilities);
+
// Enable tracing as soon as we enter the system_server.
if (pid == 0) {
Trace.setTracingEnabled(true, runtimeFlags);
}
+
+ // Set the Java Language thread priority to the default value for new apps.
+ Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
+
ZygoteHooks.postForkCommon();
return pid;
}
@@ -476,13 +491,16 @@
/**
* Fork a new unspecialized app process from the zygote
*
+ * @param usapPoolSocket The server socket the USAP will call accept on
* @param sessionSocketRawFDs Anonymous session sockets that are currently open
+ * @param isPriorityFork Value controlling the process priority level until accept is called
* @return In the Zygote process this function will always return null; in unspecialized app
* processes this function will return a Runnable object representing the new
* application that is passed up from usapMain.
*/
static Runnable forkUsap(LocalServerSocket usapPoolSocket,
- int[] sessionSocketRawFDs) {
+ int[] sessionSocketRawFDs,
+ boolean isPriorityFork) {
FileDescriptor[] pipeFDs = null;
try {
@@ -492,7 +510,8 @@
}
int pid =
- nativeForkUsap(pipeFDs[0].getInt$(), pipeFDs[1].getInt$(), sessionSocketRawFDs);
+ nativeForkUsap(pipeFDs[0].getInt$(), pipeFDs[1].getInt$(),
+ sessionSocketRawFDs, isPriorityFork);
if (pid == 0) {
IoUtils.closeQuietly(pipeFDs[0]);
@@ -506,8 +525,9 @@
}
private static native int nativeForkUsap(int readPipeFD,
- int writePipeFD,
- int[] sessionSocketRawFDs);
+ int writePipeFD,
+ int[] sessionSocketRawFDs,
+ boolean isPriorityFork);
/**
* This function is used by unspecialized app processes to wait for specialization requests from
@@ -518,7 +538,7 @@
* @return A runnable oject representing the new application.
*/
private static Runnable usapMain(LocalServerSocket usapPoolSocket,
- FileDescriptor writePipe) {
+ FileDescriptor writePipe) {
final int pid = Process.myPid();
Process.setArgV0(Process.is64Bit() ? "usap64" : "usap32");
@@ -527,6 +547,11 @@
Credentials peerCredentials = null;
ZygoteArguments args = null;
+ // Change the priority to max before calling accept so we can respond to new specialization
+ // requests as quickly as possible. This will be reverted to the default priority in the
+ // native specialization code.
+ boostUsapPriority();
+
while (true) {
try {
sessionSocket = usapPoolSocket.accept();
@@ -568,6 +593,7 @@
try {
// SIGTERM is blocked on loop exit. This prevents a USAP that is specializing from
// being killed during a pool flush.
+ setAppProcessName(args, "USAP");
applyUidSecurityPolicy(args, peerCredentials);
applyDebuggerSystemProperty(args);
@@ -628,23 +654,18 @@
}
specializeAppProcess(args.mUid, args.mGid, args.mGids,
- args.mRuntimeFlags, rlimits, args.mMountExternal,
- args.mSeInfo, args.mNiceName, args.mStartChildZygote,
- args.mInstructionSet, args.mAppDataDir);
+ args.mRuntimeFlags, rlimits, args.mMountExternal,
+ args.mSeInfo, args.mNiceName, args.mStartChildZygote,
+ args.mInstructionSet, args.mAppDataDir);
disableExecuteOnly(args.mTargetSdkVersion);
- if (args.mNiceName != null) {
- Process.setArgV0(args.mNiceName);
- }
-
- // End of the postFork event.
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
return ZygoteInit.zygoteInit(args.mTargetSdkVersion,
- args.mDisabledCompatChanges,
- args.mRemainingArgs,
- null /* classLoader */);
+ args.mDisabledCompatChanges,
+ args.mRemainingArgs,
+ null /* classLoader */);
} finally {
// Unblock SIGTERM to restore the process to default behavior.
unblockSigTerm();
@@ -663,6 +684,22 @@
private static native void nativeUnblockSigTerm();
+ private static void boostUsapPriority() {
+ nativeBoostUsapPriority();
+ }
+
+ private static native void nativeBoostUsapPriority();
+
+ static void setAppProcessName(ZygoteArguments args, String loggingTag) {
+ if (args.mNiceName != null) {
+ Process.setArgV0(args.mNiceName);
+ } else if (args.mPackageName != null) {
+ Process.setArgV0(args.mPackageName);
+ } else {
+ Log.w(loggingTag, "Unable to set package name.");
+ }
+ }
+
private static final String USAP_ERROR_PREFIX = "Invalid command to USAP: ";
/**
@@ -685,7 +722,7 @@
throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--start-child-zygote");
} else if (args.mApiBlacklistExemptions != null) {
throw new IllegalArgumentException(
- USAP_ERROR_PREFIX + "--set-api-blacklist-exemptions");
+ USAP_ERROR_PREFIX + "--set-api-blacklist-exemptions");
} else if (args.mHiddenApiAccessLogSampleRate != -1) {
throw new IllegalArgumentException(
USAP_ERROR_PREFIX + "--hidden-api-log-sampling-rate=");
@@ -696,8 +733,8 @@
throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--invoke-with");
} else if (args.mPermittedCapabilities != 0 || args.mEffectiveCapabilities != 0) {
throw new ZygoteSecurityException("Client may not specify capabilities: "
- + "permitted=0x" + Long.toHexString(args.mPermittedCapabilities)
- + ", effective=0x" + Long.toHexString(args.mEffectiveCapabilities));
+ + "permitted=0x" + Long.toHexString(args.mPermittedCapabilities)
+ + ", effective=0x" + Long.toHexString(args.mEffectiveCapabilities));
}
}
@@ -754,7 +791,7 @@
if (uidRestricted && args.mUidSpecified && (args.mUid < Process.SYSTEM_UID)) {
throw new ZygoteSecurityException(
"System UID may not launch process with UID < "
- + Process.SYSTEM_UID);
+ + Process.SYSTEM_UID);
}
}
@@ -804,8 +841,8 @@
if (args.mInvokeWith != null && peerUid != 0
&& (args.mRuntimeFlags & Zygote.DEBUG_ENABLE_JDWP) == 0) {
throw new ZygoteSecurityException("Peer is permitted to specify an "
- + "explicit invoke-with wrapper command only for debuggable "
- + "applications.");
+ + "explicit invoke-with wrapper command only for debuggable "
+ + "applications.");
}
}
@@ -888,7 +925,7 @@
return new LocalServerSocket(fd);
} catch (IOException ex) {
throw new RuntimeException(
- "Error building socket from file descriptor: " + fileDesc, ex);
+ "Error building socket from file descriptor: " + fileDesc, ex);
}
}
@@ -903,15 +940,6 @@
}
/**
- * Resets the calling thread priority to the default value (Thread.NORM_PRIORITY
- * or nice value 0). This updates both the priority value in java.lang.Thread and
- * the nice value (setpriority).
- */
- static void resetNicePriority() {
- Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
- }
-
- /**
* Executes "/system/bin/sh -c <command>" using the exec() system call.
* This method throws a runtime exception if exec() failed, otherwise, this
* method never returns.
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
index e8d6681..2666d52 100644
--- a/core/java/com/android/internal/os/ZygoteConnection.java
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
@@ -346,7 +346,7 @@
if (zygoteServer.isUsapPoolEnabled()) {
Runnable fpResult =
zygoteServer.fillUsapPool(
- new int[]{mSocket.getFileDescriptor().getInt$()});
+ new int[]{mSocket.getFileDescriptor().getInt$()}, false);
if (fpResult != null) {
zygoteServer.setForkChild();
@@ -485,9 +485,7 @@
closeSocket();
- if (parsedArgs.mNiceName != null) {
- Process.setArgV0(parsedArgs.mNiceName);
- }
+ Zygote.setAppProcessName(parsedArgs, TAG);
// End of the postFork event.
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index fd02237..348262e 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -825,6 +825,18 @@
return result;
}
+ /**
+ * This is the entry point for a Zygote process. It creates the Zygote server, loads resources,
+ * and handles other tasks related to preparing the process for forking into applications.
+ *
+ * This process is started with a nice value of -20 (highest priority). All paths that flow
+ * into new processes are required to either set the priority to the default value or terminate
+ * before executing any non-system code. The native side of this occurs in SpecializeCommon,
+ * while the Java Language priority is changed in ZygoteInit.handleSystemServerProcess,
+ * ZygoteConnection.handleChildProc, and Zygote.usapMain.
+ *
+ * @param argv Command line arguments used to specify the Zygote's configuration.
+ */
@UnsupportedAppUsage
public static void main(String argv[]) {
ZygoteServer zygoteServer = null;
@@ -888,8 +900,6 @@
EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_END,
SystemClock.uptimeMillis());
bootTimingsTraceLog.traceEnd(); // ZygotePreload
- } else {
- Zygote.resetNicePriority();
}
// Do an initial gc to clean up after startup
diff --git a/core/java/com/android/internal/os/ZygoteServer.java b/core/java/com/android/internal/os/ZygoteServer.java
index 1fd6e26..8d281b7 100644
--- a/core/java/com/android/internal/os/ZygoteServer.java
+++ b/core/java/com/android/internal/os/ZygoteServer.java
@@ -66,6 +66,12 @@
/** The default value used for the USAP_POOL_SIZE_MIN device property */
private static final String USAP_POOL_SIZE_MIN_DEFAULT = "1";
+ /** The default value used for the USAP_REFILL_DELAY_MS device property */
+ private static final String USAP_POOL_REFILL_DELAY_MS_DEFAULT = "3000";
+
+ /** The "not a timestamp" value for the refill delay timestamp mechanism. */
+ private static final int INVALID_TIMESTAMP = -1;
+
/**
* Indicates if this Zygote server can support a unspecialized app process pool. Currently this
* should only be true for the primary and secondary Zygotes, and not the App Zygotes or the
@@ -131,6 +137,24 @@
*/
private int mUsapPoolRefillThreshold = 0;
+ /**
+ * Number of milliseconds to delay before refilling the pool if it hasn't reached its
+ * minimum value.
+ */
+ private int mUsapPoolRefillDelayMs = -1;
+
+ /**
+ * If and when we should refill the USAP pool.
+ */
+ private UsapPoolRefillAction mUsapPoolRefillAction;
+ private long mUsapPoolRefillTriggerTimestamp;
+
+ private enum UsapPoolRefillAction {
+ DELAYED,
+ IMMEDIATE,
+ NONE
+ }
+
ZygoteServer() {
mUsapPoolEventFD = null;
mZygoteSocket = null;
@@ -160,9 +184,8 @@
Zygote.USAP_POOL_SECONDARY_SOCKET_NAME);
}
- fetchUsapPoolPolicyProps();
-
mUsapPoolSupported = true;
+ fetchUsapPoolPolicyProps();
}
void setForkChild() {
@@ -267,6 +290,13 @@
mUsapPoolSizeMax);
}
+ final String usapPoolRefillDelayMsPropString = Zygote.getConfigurationProperty(
+ ZygoteConfig.USAP_POOL_REFILL_DELAY_MS, USAP_POOL_REFILL_DELAY_MS_DEFAULT);
+
+ if (!usapPoolRefillDelayMsPropString.isEmpty()) {
+ mUsapPoolRefillDelayMs = Integer.parseInt(usapPoolRefillDelayMsPropString);
+ }
+
// Sanity check
if (mUsapPoolSizeMin >= mUsapPoolSizeMax) {
Log.w(TAG, "The max size of the USAP pool must be greater than the minimum size."
@@ -293,9 +323,16 @@
}
}
+ private void fetchUsapPoolPolicyPropsIfUnfetched() {
+ if (mIsFirstPropertyCheck) {
+ mIsFirstPropertyCheck = false;
+ fetchUsapPoolPolicyProps();
+ }
+ }
+
/**
- * Checks to see if the current policy says that pool should be refilled, and spawns new USAPs
- * if necessary.
+ * Refill the USAP Pool to the appropriate level, determined by whether this is a priority
+ * refill event or not.
*
* @param sessionSocketRawFDs Anonymous session sockets that are currently open
* @return In the Zygote process this function will always return null; in unspecialized app
@@ -303,39 +340,48 @@
* application that is passed up from usapMain.
*/
- Runnable fillUsapPool(int[] sessionSocketRawFDs) {
+ Runnable fillUsapPool(int[] sessionSocketRawFDs, boolean isPriorityRefill) {
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "Zygote:FillUsapPool");
// Ensure that the pool properties have been fetched.
- fetchUsapPoolPolicyPropsWithMinInterval();
+ fetchUsapPoolPolicyPropsIfUnfetched();
int usapPoolCount = Zygote.getUsapPoolCount();
- int numUsapsToSpawn = mUsapPoolSizeMax - usapPoolCount;
+ int numUsapsToSpawn;
- if (usapPoolCount < mUsapPoolSizeMin
- || numUsapsToSpawn >= mUsapPoolRefillThreshold) {
-
- // Disable some VM functionality and reset some system values
- // before forking.
- ZygoteHooks.preFork();
- Zygote.resetNicePriority();
-
- while (usapPoolCount++ < mUsapPoolSizeMax) {
- Runnable caller = Zygote.forkUsap(mUsapPoolSocket, sessionSocketRawFDs);
-
- if (caller != null) {
- return caller;
- }
- }
-
- // Re-enable runtime services for the Zygote. Services for unspecialized app process
- // are re-enabled in specializeAppProcess.
- ZygoteHooks.postForkCommon();
+ if (isPriorityRefill) {
+ // Refill to min
+ numUsapsToSpawn = mUsapPoolSizeMin - usapPoolCount;
Log.i("zygote",
- "Filled the USAP pool. New USAPs: " + numUsapsToSpawn);
+ "Priority USAP Pool refill. New USAPs: " + numUsapsToSpawn);
+ } else {
+ // Refill up to max
+ numUsapsToSpawn = mUsapPoolSizeMax - usapPoolCount;
+
+ Log.i("zygote",
+ "Delayed USAP Pool refill. New USAPs: " + numUsapsToSpawn);
}
+ // Disable some VM functionality and reset some system values
+ // before forking.
+ ZygoteHooks.preFork();
+
+ while (--numUsapsToSpawn >= 0) {
+ Runnable caller =
+ Zygote.forkUsap(mUsapPoolSocket, sessionSocketRawFDs, isPriorityRefill);
+
+ if (caller != null) {
+ return caller;
+ }
+ }
+
+ // Re-enable runtime services for the Zygote. Services for unspecialized app process
+ // are re-enabled in specializeAppProcess.
+ ZygoteHooks.postForkCommon();
+
+ resetUsapRefillState();
+
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
return null;
@@ -358,13 +404,18 @@
mUsapPoolEnabled = newStatus;
if (newStatus) {
- return fillUsapPool(new int[]{ sessionSocket.getFileDescriptor().getInt$() });
+ return fillUsapPool(new int[]{ sessionSocket.getFileDescriptor().getInt$() }, false);
} else {
Zygote.emptyUsapPool();
return null;
}
}
+ void resetUsapRefillState() {
+ mUsapPoolRefillAction = UsapPoolRefillAction.NONE;
+ mUsapPoolRefillTriggerTimestamp = INVALID_TIMESTAMP;
+ }
+
/**
* Runs the zygote process's select loop. Accepts new connections as
* they happen, and reads commands from connections one spawn-request's
@@ -377,8 +428,11 @@
socketFDs.add(mZygoteSocket.getFileDescriptor());
peers.add(null);
+ mUsapPoolRefillTriggerTimestamp = INVALID_TIMESTAMP;
+
while (true) {
fetchUsapPoolPolicyPropsWithMinInterval();
+ mUsapPoolRefillAction = UsapPoolRefillAction.NONE;
int[] usapPipeFDs = null;
StructPollfd[] pollFDs;
@@ -430,140 +484,199 @@
}
}
+ int pollTimeoutMs;
+
+ if (mUsapPoolRefillTriggerTimestamp == INVALID_TIMESTAMP) {
+ pollTimeoutMs = -1;
+ } else {
+ long elapsedTimeMs = System.currentTimeMillis() - mUsapPoolRefillTriggerTimestamp;
+
+ if (elapsedTimeMs >= mUsapPoolRefillDelayMs) {
+ // Normalize the poll timeout value when the time between one poll event and the
+ // next pushes us over the delay value. This prevents poll receiving a 0
+ // timeout value, which would result in it returning immediately.
+ pollTimeoutMs = -1;
+
+ } else if (elapsedTimeMs <= 0) {
+ // This can occur if the clock used by currentTimeMillis is reset, which is
+ // possible because it is not guaranteed to be monotonic. Because we can't tell
+ // how far back the clock was set the best way to recover is to simply re-start
+ // the respawn delay countdown.
+ pollTimeoutMs = mUsapPoolRefillDelayMs;
+
+ } else {
+ pollTimeoutMs = (int) (mUsapPoolRefillDelayMs - elapsedTimeMs);
+ }
+ }
+
+ int pollReturnValue;
try {
- Os.poll(pollFDs, -1);
+ pollReturnValue = Os.poll(pollFDs, pollTimeoutMs);
} catch (ErrnoException ex) {
throw new RuntimeException("poll failed", ex);
}
- boolean usapPoolFDRead = false;
+ if (pollReturnValue == 0) {
+ // The poll timeout has been exceeded. This only occurs when we have finished the
+ // USAP pool refill delay period.
- while (--pollIndex >= 0) {
- if ((pollFDs[pollIndex].revents & POLLIN) == 0) {
- continue;
- }
+ mUsapPoolRefillTriggerTimestamp = INVALID_TIMESTAMP;
+ mUsapPoolRefillAction = UsapPoolRefillAction.DELAYED;
- if (pollIndex == 0) {
- // Zygote server socket
+ } else {
+ boolean usapPoolFDRead = false;
- ZygoteConnection newPeer = acceptCommandPeer(abiList);
- peers.add(newPeer);
- socketFDs.add(newPeer.getFileDescriptor());
-
- } else if (pollIndex < usapPoolEventFDIndex) {
- // Session socket accepted from the Zygote server socket
-
- try {
- ZygoteConnection connection = peers.get(pollIndex);
- final Runnable command = connection.processOneCommand(this);
-
- // TODO (chriswailes): Is this extra check necessary?
- if (mIsForkChild) {
- // We're in the child. We should always have a command to run at this
- // stage if processOneCommand hasn't called "exec".
- if (command == null) {
- throw new IllegalStateException("command == null");
- }
-
- return command;
- } else {
- // We're in the server - we should never have any commands to run.
- if (command != null) {
- throw new IllegalStateException("command != null");
- }
-
- // We don't know whether the remote side of the socket was closed or
- // not until we attempt to read from it from processOneCommand. This
- // shows up as a regular POLLIN event in our regular processing loop.
- if (connection.isClosedByPeer()) {
- connection.closeSocket();
- peers.remove(pollIndex);
- socketFDs.remove(pollIndex);
- }
- }
- } catch (Exception e) {
- if (!mIsForkChild) {
- // We're in the server so any exception here is one that has taken place
- // pre-fork while processing commands or reading / writing from the
- // control socket. Make a loud noise about any such exceptions so that
- // we know exactly what failed and why.
-
- Slog.e(TAG, "Exception executing zygote command: ", e);
-
- // Make sure the socket is closed so that the other end knows
- // immediately that something has gone wrong and doesn't time out
- // waiting for a response.
- ZygoteConnection conn = peers.remove(pollIndex);
- conn.closeSocket();
-
- socketFDs.remove(pollIndex);
- } else {
- // We're in the child so any exception caught here has happened post
- // fork and before we execute ActivityThread.main (or any other main()
- // method). Log the details of the exception and bring down the process.
- Log.e(TAG, "Caught post-fork exception in child process.", e);
- throw e;
- }
- } finally {
- // Reset the child flag, in the event that the child process is a child-
- // zygote. The flag will not be consulted this loop pass after the Runnable
- // is returned.
- mIsForkChild = false;
- }
- } else {
- // Either the USAP pool event FD or a USAP reporting pipe.
-
- // If this is the event FD the payload will be the number of USAPs removed.
- // If this is a reporting pipe FD the payload will be the PID of the USAP
- // that was just specialized.
- long messagePayload = -1;
-
- try {
- byte[] buffer = new byte[Zygote.USAP_MANAGEMENT_MESSAGE_BYTES];
- int readBytes = Os.read(pollFDs[pollIndex].fd, buffer, 0, buffer.length);
-
- if (readBytes == Zygote.USAP_MANAGEMENT_MESSAGE_BYTES) {
- DataInputStream inputStream =
- new DataInputStream(new ByteArrayInputStream(buffer));
-
- messagePayload = inputStream.readLong();
- } else {
- Log.e(TAG, "Incomplete read from USAP management FD of size "
- + readBytes);
- continue;
- }
- } catch (Exception ex) {
- if (pollIndex == usapPoolEventFDIndex) {
- Log.e(TAG, "Failed to read from USAP pool event FD: "
- + ex.getMessage());
- } else {
- Log.e(TAG, "Failed to read from USAP reporting pipe: "
- + ex.getMessage());
- }
-
+ while (--pollIndex >= 0) {
+ if ((pollFDs[pollIndex].revents & POLLIN) == 0) {
continue;
}
- if (pollIndex > usapPoolEventFDIndex) {
- Zygote.removeUsapTableEntry((int) messagePayload);
- }
+ if (pollIndex == 0) {
+ // Zygote server socket
- usapPoolFDRead = true;
+ ZygoteConnection newPeer = acceptCommandPeer(abiList);
+ peers.add(newPeer);
+ socketFDs.add(newPeer.getFileDescriptor());
+
+ } else if (pollIndex < usapPoolEventFDIndex) {
+ // Session socket accepted from the Zygote server socket
+
+ try {
+ ZygoteConnection connection = peers.get(pollIndex);
+ final Runnable command = connection.processOneCommand(this);
+
+ // TODO (chriswailes): Is this extra check necessary?
+ if (mIsForkChild) {
+ // We're in the child. We should always have a command to run at
+ // this stage if processOneCommand hasn't called "exec".
+ if (command == null) {
+ throw new IllegalStateException("command == null");
+ }
+
+ return command;
+ } else {
+ // We're in the server - we should never have any commands to run.
+ if (command != null) {
+ throw new IllegalStateException("command != null");
+ }
+
+ // We don't know whether the remote side of the socket was closed or
+ // not until we attempt to read from it from processOneCommand. This
+ // shows up as a regular POLLIN event in our regular processing
+ // loop.
+ if (connection.isClosedByPeer()) {
+ connection.closeSocket();
+ peers.remove(pollIndex);
+ socketFDs.remove(pollIndex);
+ }
+ }
+ } catch (Exception e) {
+ if (!mIsForkChild) {
+ // We're in the server so any exception here is one that has taken
+ // place pre-fork while processing commands or reading / writing
+ // from the control socket. Make a loud noise about any such
+ // exceptions so that we know exactly what failed and why.
+
+ Slog.e(TAG, "Exception executing zygote command: ", e);
+
+ // Make sure the socket is closed so that the other end knows
+ // immediately that something has gone wrong and doesn't time out
+ // waiting for a response.
+ ZygoteConnection conn = peers.remove(pollIndex);
+ conn.closeSocket();
+
+ socketFDs.remove(pollIndex);
+ } else {
+ // We're in the child so any exception caught here has happened post
+ // fork and before we execute ActivityThread.main (or any other
+ // main() method). Log the details of the exception and bring down
+ // the process.
+ Log.e(TAG, "Caught post-fork exception in child process.", e);
+ throw e;
+ }
+ } finally {
+ // Reset the child flag, in the event that the child process is a child-
+ // zygote. The flag will not be consulted this loop pass after the
+ // Runnable is returned.
+ mIsForkChild = false;
+ }
+
+ } else {
+ // Either the USAP pool event FD or a USAP reporting pipe.
+
+ // If this is the event FD the payload will be the number of USAPs removed.
+ // If this is a reporting pipe FD the payload will be the PID of the USAP
+ // that was just specialized. The `continue` statements below ensure that
+ // the messagePayload will always be valid if we complete the try block
+ // without an exception.
+ long messagePayload;
+
+ try {
+ byte[] buffer = new byte[Zygote.USAP_MANAGEMENT_MESSAGE_BYTES];
+ int readBytes =
+ Os.read(pollFDs[pollIndex].fd, buffer, 0, buffer.length);
+
+ if (readBytes == Zygote.USAP_MANAGEMENT_MESSAGE_BYTES) {
+ DataInputStream inputStream =
+ new DataInputStream(new ByteArrayInputStream(buffer));
+
+ messagePayload = inputStream.readLong();
+ } else {
+ Log.e(TAG, "Incomplete read from USAP management FD of size "
+ + readBytes);
+ continue;
+ }
+ } catch (Exception ex) {
+ if (pollIndex == usapPoolEventFDIndex) {
+ Log.e(TAG, "Failed to read from USAP pool event FD: "
+ + ex.getMessage());
+ } else {
+ Log.e(TAG, "Failed to read from USAP reporting pipe: "
+ + ex.getMessage());
+ }
+
+ continue;
+ }
+
+ if (pollIndex > usapPoolEventFDIndex) {
+ Zygote.removeUsapTableEntry((int) messagePayload);
+ }
+
+ usapPoolFDRead = true;
+ }
+ }
+
+ if (usapPoolFDRead) {
+ int usapPoolCount = Zygote.getUsapPoolCount();
+
+ if (usapPoolCount < mUsapPoolSizeMin) {
+ // Immediate refill
+ mUsapPoolRefillAction = UsapPoolRefillAction.IMMEDIATE;
+ } else if (mUsapPoolSizeMax - usapPoolCount >= mUsapPoolRefillThreshold) {
+ // Delayed refill
+ mUsapPoolRefillTriggerTimestamp = System.currentTimeMillis();
+ }
}
}
- // Check to see if the USAP pool needs to be refilled.
- if (usapPoolFDRead) {
+ if (mUsapPoolRefillAction != UsapPoolRefillAction.NONE) {
int[] sessionSocketRawFDs =
socketFDs.subList(1, socketFDs.size())
.stream()
.mapToInt(FileDescriptor::getInt$)
.toArray();
- final Runnable command = fillUsapPool(sessionSocketRawFDs);
+ final boolean isPriorityRefill =
+ mUsapPoolRefillAction == UsapPoolRefillAction.IMMEDIATE;
+
+ final Runnable command =
+ fillUsapPool(sessionSocketRawFDs, isPriorityRefill);
if (command != null) {
return command;
+ } else if (isPriorityRefill) {
+ // Schedule a delayed refill to finish refilling the pool.
+ mUsapPoolRefillTriggerTimestamp = System.currentTimeMillis();
}
}
}
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 58fd9c0..8cff0fd 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -169,6 +169,15 @@
*/
static constexpr int USAP_POOL_SIZE_MAX_LIMIT = 100;
+/** The numeric value for the maximum priority a process may possess. */
+static constexpr int PROCESS_PRIORITY_MAX = -20;
+
+/** The numeric value for the minimum priority a process may possess. */
+static constexpr int PROCESS_PRIORITY_MIN = 19;
+
+/** The numeric value for the normal priority a process should have. */
+static constexpr int PROCESS_PRIORITY_DEFAULT = 0;
+
/**
* A helper class containing accounting information for USAPs.
*/
@@ -903,7 +912,8 @@
// Utility routine to fork a process from the zygote.
static pid_t ForkCommon(JNIEnv* env, bool is_system_server,
const std::vector<int>& fds_to_close,
- const std::vector<int>& fds_to_ignore) {
+ const std::vector<int>& fds_to_ignore,
+ bool is_priority_fork) {
SetSignalHandlers();
// Curry a failure function.
@@ -936,6 +946,12 @@
pid_t pid = fork();
if (pid == 0) {
+ if (is_priority_fork) {
+ setpriority(PRIO_PROCESS, 0, PROCESS_PRIORITY_MAX);
+ } else {
+ setpriority(PRIO_PROCESS, 0, PROCESS_PRIORITY_MIN);
+ }
+
// The child process.
PreApplicationInit();
@@ -1133,6 +1149,9 @@
env->CallStaticVoidMethod(gZygoteClass, gCallPostForkChildHooks, runtime_flags,
is_system_server, is_child_zygote, managed_instruction_set);
+ // Reset the process priority to the default value.
+ setpriority(PRIO_PROCESS, 0, PROCESS_PRIORITY_DEFAULT);
+
if (env->ExceptionCheck()) {
fail_fn("Error calling post fork hooks.");
}
@@ -1372,7 +1391,7 @@
fds_to_ignore.push_back(gUsapPoolEventFD);
}
- pid_t pid = ForkCommon(env, false, fds_to_close, fds_to_ignore);
+ pid_t pid = ForkCommon(env, false, fds_to_close, fds_to_ignore, true);
if (pid == 0) {
SpecializeCommon(env, uid, gid, gids, runtime_flags, rlimits,
@@ -1399,7 +1418,8 @@
pid_t pid = ForkCommon(env, true,
fds_to_close,
- fds_to_ignore);
+ fds_to_ignore,
+ true);
if (pid == 0) {
SpecializeCommon(env, uid, gid, gids, runtime_flags, rlimits,
permitted_capabilities, effective_capabilities,
@@ -1441,13 +1461,15 @@
* zygote in managed code.
* @param managed_session_socket_fds A list of anonymous session sockets that must be ignored by
* the FD hygiene code and automatically "closed" in the new USAP.
+ * @param is_priority_fork Controls the nice level assigned to the newly created process
* @return
*/
static jint com_android_internal_os_Zygote_nativeForkUsap(JNIEnv* env,
jclass,
jint read_pipe_fd,
jint write_pipe_fd,
- jintArray managed_session_socket_fds) {
+ jintArray managed_session_socket_fds,
+ jboolean is_priority_fork) {
std::vector<int> fds_to_close(MakeUsapPipeReadFDVector()),
fds_to_ignore(fds_to_close);
@@ -1469,7 +1491,8 @@
fds_to_ignore.push_back(write_pipe_fd);
fds_to_ignore.insert(fds_to_ignore.end(), session_socket_fds.begin(), session_socket_fds.end());
- pid_t usap_pid = ForkCommon(env, /* is_system_server= */ false, fds_to_close, fds_to_ignore);
+ pid_t usap_pid = ForkCommon(env, /* is_system_server= */ false, fds_to_close, fds_to_ignore,
+ is_priority_fork == JNI_TRUE);
if (usap_pid != 0) {
++gUsapPoolCount;
@@ -1706,6 +1729,10 @@
UnblockSignal(SIGTERM, fail_fn);
}
+static void com_android_internal_os_Zygote_nativeBoostUsapPriority(JNIEnv* env, jclass) {
+ setpriority(PRIO_PROCESS, 0, PROCESS_PRIORITY_MAX);
+}
+
static const JNINativeMethod gMethods[] = {
{ "nativeForkAndSpecialize",
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;)I",
@@ -1718,7 +1745,7 @@
(void *) com_android_internal_os_Zygote_nativePreApplicationInit },
{ "nativeInstallSeccompUidGidFilter", "(II)V",
(void *) com_android_internal_os_Zygote_nativeInstallSeccompUidGidFilter },
- { "nativeForkUsap", "(II[I)I",
+ { "nativeForkUsap", "(II[IZ)I",
(void *) com_android_internal_os_Zygote_nativeForkUsap },
{ "nativeSpecializeAppProcess",
"(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;)V",
@@ -1740,7 +1767,9 @@
{ "nativeBlockSigTerm", "()V",
(void* ) com_android_internal_os_Zygote_nativeBlockSigTerm },
{ "nativeUnblockSigTerm", "()V",
- (void* ) com_android_internal_os_Zygote_nativeUnblockSigTerm }
+ (void* ) com_android_internal_os_Zygote_nativeUnblockSigTerm },
+ { "nativeBoostUsapPriority", "()V",
+ (void* ) com_android_internal_os_Zygote_nativeBoostUsapPriority }
};
int register_com_android_internal_os_Zygote(JNIEnv* env) {
diff --git a/data/etc/Android.bp b/data/etc/Android.bp
index 4493f3a..0d12e1f 100644
--- a/data/etc/Android.bp
+++ b/data/etc/Android.bp
@@ -43,7 +43,7 @@
prebuilt_etc {
name: "privapp_whitelist_com.android.carrierconfig",
- product_specific: true,
+ system_ext_specific: true,
sub_dir: "permissions",
src: "com.android.carrierconfig.xml",
filename_from_src: true,
@@ -67,7 +67,7 @@
prebuilt_etc {
name: "privapp_whitelist_com.android.emergency",
- product_specific: true,
+ system_ext_specific: true,
sub_dir: "permissions",
src: "com.android.emergency.xml",
filename_from_src: true,
@@ -82,7 +82,7 @@
prebuilt_etc {
name: "privapp_whitelist_com.android.launcher3",
- product_specific: true,
+ system_ext_specific: true,
sub_dir: "permissions",
src: "com.android.launcher3.xml",
filename_from_src: true,
@@ -90,7 +90,7 @@
prebuilt_etc {
name: "privapp_whitelist_com.android.provision",
- product_specific: true,
+ system_ext_specific: true,
sub_dir: "permissions",
src: "com.android.provision.xml",
filename_from_src: true,
@@ -98,7 +98,7 @@
prebuilt_etc {
name: "privapp_whitelist_com.android.settings",
- product_specific: true,
+ system_ext_specific: true,
sub_dir: "permissions",
src: "com.android.settings.xml",
filename_from_src: true,
@@ -114,7 +114,7 @@
prebuilt_etc {
name: "privapp_whitelist_com.android.storagemanager",
- product_specific: true,
+ system_ext_specific: true,
sub_dir: "permissions",
src: "com.android.storagemanager.xml",
filename_from_src: true,
@@ -122,7 +122,7 @@
prebuilt_etc {
name: "privapp_whitelist_com.android.systemui",
- product_specific: true,
+ system_ext_specific: true,
sub_dir: "permissions",
src: "com.android.systemui.xml",
filename_from_src: true,
diff --git a/data/etc/CleanSpec.mk b/data/etc/CleanSpec.mk
new file mode 100644
index 0000000..783a7ed
--- /dev/null
+++ b/data/etc/CleanSpec.mk
@@ -0,0 +1,60 @@
+# Copyright (C) 2019 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.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list. These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list. E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# *****************************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THE BANNER
+# *****************************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/product/etc/permissions/com.android.carrierconfig.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product/etc/permissions/com.android.carrierconfig.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/product/etc/permissions/com.android.emergency.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product/etc/permissions/com.android.emergency.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/product/etc/permissions/com.android.provision.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product/etc/permissions/com.android.provision.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/product/etc/permissions/com.android.settings.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product/etc/permissions/com.android.settings.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/product/etc/permissions/com.android.launcher3.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product/etc/permissions/com.android.launcher3.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/product/etc/permissions/com.android.systemui.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product/etc/permissions/com.android.systemui.xml)
+# ******************************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
+# ******************************************************************
diff --git a/data/etc/car/Android.bp b/data/etc/car/Android.bp
index 9272ea5..7faf4cd 100644
--- a/data/etc/car/Android.bp
+++ b/data/etc/car/Android.bp
@@ -126,5 +126,5 @@
sub_dir: "permissions",
src: "com.android.car.developeroptions.xml",
filename_from_src: true,
- product_specific: true,
+ system_ext_specific: true,
}
diff --git a/data/etc/car/CleanSpec.mk b/data/etc/car/CleanSpec.mk
new file mode 100644
index 0000000..18f7d34
--- /dev/null
+++ b/data/etc/car/CleanSpec.mk
@@ -0,0 +1,50 @@
+# Copyright (C) 2019 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.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list. These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list. E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# *****************************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THE BANNER
+# *****************************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/product/etc/permissions/com.android.car.developeroptions.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product/etc/permissions/com.android.car.developeroptions.xml)
+# ******************************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
+# ******************************************************************
diff --git a/data/etc/com.android.systemui.xml b/data/etc/com.android.systemui.xml
index a305d48..1d73567 100644
--- a/data/etc/com.android.systemui.xml
+++ b/data/etc/com.android.systemui.xml
@@ -22,7 +22,6 @@
<permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
<permission name="android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST"/>
<permission name="android.permission.CHANGE_OVERLAY_PACKAGES"/>
- <permission name="android.permission.CONNECTIVITY_INTERNAL"/>
<permission name="android.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS"/>
<permission name="android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS"/>
<permission name="android.permission.CONTROL_VPN"/>
@@ -38,6 +37,7 @@
<permission name="android.permission.MODIFY_DAY_NIGHT_MODE"/>
<permission name="android.permission.MODIFY_PHONE_STATE"/>
<permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
+ <permission name="android.permission.OBSERVE_NETWORK_POLICY"/>
<permission name="android.permission.OVERRIDE_WIFI_CONFIG"/>
<permission name="android.permission.READ_DREAM_STATE"/>
<permission name="android.permission.READ_FRAME_BUFFER"/>
diff --git a/packages/CarSystemUI/Android.bp b/packages/CarSystemUI/Android.bp
index 672879a..68da999 100644
--- a/packages/CarSystemUI/Android.bp
+++ b/packages/CarSystemUI/Android.bp
@@ -82,7 +82,7 @@
],
platform_apis: true,
- product_specific: true,
+ system_ext_specific: true,
certificate: "platform",
privileged: true,
diff --git a/packages/CarSystemUI/CleanSpec.mk b/packages/CarSystemUI/CleanSpec.mk
new file mode 100644
index 0000000..ceac67c
--- /dev/null
+++ b/packages/CarSystemUI/CleanSpec.mk
@@ -0,0 +1,50 @@
+# Copyright (C) 2019 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.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list. These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list. E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# *****************************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THE BANNER
+# *****************************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/product/priv-app/CarSystemUI)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product/priv-app/CarSystemUI)
+# ******************************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
+# ******************************************************************
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
index c2ce840..9ccb837 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
@@ -56,6 +56,7 @@
import android.os.RemoteException;
import android.os.image.DynamicSystemClient;
import android.os.image.DynamicSystemManager;
+import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
@@ -74,6 +75,8 @@
// TODO (b/131866826): This is currently for test only. Will move this to System API.
static final String KEY_ENABLE_WHEN_COMPLETED = "KEY_ENABLE_WHEN_COMPLETED";
+ static final String KEY_DSU_SLOT = "KEY_DSU_SLOT";
+ static final String DEFAULT_DSU_SLOT = "dsu";
/*
* Intent actions
@@ -244,10 +247,15 @@
long systemSize = intent.getLongExtra(DynamicSystemClient.KEY_SYSTEM_SIZE, 0);
long userdataSize = intent.getLongExtra(DynamicSystemClient.KEY_USERDATA_SIZE, 0);
mEnableWhenCompleted = intent.getBooleanExtra(KEY_ENABLE_WHEN_COMPLETED, false);
+ String dsuSlot = intent.getStringExtra(KEY_DSU_SLOT);
+ if (TextUtils.isEmpty(dsuSlot)) {
+ dsuSlot = DEFAULT_DSU_SLOT;
+ }
// TODO: better constructor or builder
- mInstallTask = new InstallationAsyncTask(
- url, systemSize, userdataSize, this, mDynSystem, this);
+ mInstallTask =
+ new InstallationAsyncTask(
+ url, dsuSlot, systemSize, userdataSize, this, mDynSystem, this);
mInstallTask.execute();
@@ -409,7 +417,9 @@
break;
case STATUS_READY:
- builder.setContentText(getString(R.string.notification_install_completed));
+ String msgCompleted = getString(R.string.notification_install_completed);
+ builder.setContentText(msgCompleted)
+ .setStyle(new Notification.BigTextStyle().bigText(msgCompleted));
builder.addAction(new Notification.Action.Builder(
null, getString(R.string.notification_action_discard),
@@ -422,7 +432,9 @@
break;
case STATUS_IN_USE:
- builder.setContentText(getString(R.string.notification_dynsystem_in_use));
+ String msgInUse = getString(R.string.notification_dynsystem_in_use);
+ builder.setContentText(msgInUse)
+ .setStyle(new Notification.BigTextStyle().bigText(msgInUse));
builder.addAction(new Notification.Action.Builder(
null, getString(R.string.notification_action_uninstall),
@@ -452,7 +464,49 @@
}
private void postStatus(int status, int cause, Throwable detail) {
- Log.d(TAG, "postStatus(): statusCode=" + status + ", causeCode=" + cause);
+ String statusString;
+ String causeString;
+
+ switch (status) {
+ case STATUS_NOT_STARTED:
+ statusString = "NOT_STARTED";
+ break;
+ case STATUS_IN_PROGRESS:
+ statusString = "IN_PROGRESS";
+ break;
+ case STATUS_READY:
+ statusString = "READY";
+ break;
+ case STATUS_IN_USE:
+ statusString = "IN_USE";
+ break;
+ default:
+ statusString = "UNKNOWN";
+ break;
+ }
+
+ switch (cause) {
+ case CAUSE_INSTALL_COMPLETED:
+ causeString = "INSTALL_COMPLETED";
+ break;
+ case CAUSE_INSTALL_CANCELLED:
+ causeString = "INSTALL_CANCELLED";
+ break;
+ case CAUSE_ERROR_IO:
+ causeString = "ERROR_IO";
+ break;
+ case CAUSE_ERROR_INVALID_URL:
+ causeString = "ERROR_INVALID_URL";
+ break;
+ case CAUSE_ERROR_EXCEPTION:
+ causeString = "ERROR_EXCEPTION";
+ break;
+ default:
+ causeString = "CAUSE_NOT_SPECIFIED";
+ break;
+ }
+
+ Log.d(TAG, "status=" + statusString + ", cause=" + causeString);
boolean notifyOnNotificationBar = true;
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
index b206a1f..9aea0e7 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
@@ -89,10 +89,12 @@
interface ProgressListener {
void onProgressUpdate(Progress progress);
+
void onResult(int resultCode, Throwable detail);
}
private final String mUrl;
+ private final String mDsuSlot;
private final long mSystemSize;
private final long mUserdataSize;
private final Context mContext;
@@ -106,9 +108,16 @@
private InputStream mStream;
private ZipFile mZipFile;
- InstallationAsyncTask(String url, long systemSize, long userdataSize, Context context,
- DynamicSystemManager dynSystem, ProgressListener listener) {
+ InstallationAsyncTask(
+ String url,
+ String dsuSlot,
+ long systemSize,
+ long userdataSize,
+ Context context,
+ DynamicSystemManager dynSystem,
+ ProgressListener listener) {
mUrl = url;
+ mDsuSlot = dsuSlot;
mSystemSize = systemSize;
mUserdataSize = userdataSize;
mContext = context;
@@ -126,14 +135,17 @@
verifyAndPrepare();
- mDynSystem.startInstallation();
+ mDynSystem.startInstallation(mDsuSlot);
installUserdata();
if (isCancelled()) {
mDynSystem.remove();
return null;
}
-
+ if (mUrl == null) {
+ mDynSystem.finishInstallation();
+ return null;
+ }
installImages();
if (isCancelled()) {
mDynSystem.remove();
@@ -194,6 +206,9 @@
}
private void verifyAndPrepare() throws Exception {
+ if (mUrl == null) {
+ return;
+ }
String extension = mUrl.substring(mUrl.lastIndexOf('.') + 1);
if ("gz".equals(extension) || "gzip".equals(extension)) {
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java
index 3b3933b..e42ded7 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java
@@ -28,11 +28,9 @@
import android.util.FeatureFlagUtils;
import android.util.Log;
-
/**
- * This Activity starts KeyguardManager and ask the user to confirm
- * before any installation request. If the device is not protected by
- * a password, it approves the request by default.
+ * This Activity starts KeyguardManager and ask the user to confirm before any installation request.
+ * If the device is not protected by a password, it approves the request by default.
*/
public class VerificationActivity extends Activity {
@@ -88,11 +86,15 @@
Uri url = callingIntent.getData();
Bundle extras = callingIntent.getExtras();
- sVerifiedUrl = url.toString();
+ if (url != null) {
+ sVerifiedUrl = url.toString();
+ }
// start service
Intent intent = new Intent(this, DynamicSystemInstallationService.class);
- intent.setData(url);
+ if (url != null) {
+ intent.setData(url);
+ }
intent.setAction(DynamicSystemClient.ACTION_START_INSTALL);
intent.putExtras(extras);
@@ -106,6 +108,7 @@
}
static boolean isVerified(String url) {
+ if (url == null) return true;
return sVerifiedUrl != null && sVerifiedUrl.equals(url);
}
}
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index d674be4..dbfaca0 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -142,7 +142,7 @@
resource_dirs: [],
platform_apis: true,
- product_specific: true,
+ system_ext_specific: true,
certificate: "platform",
privileged: true,
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 403e894..262365d 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -72,7 +72,7 @@
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.OVERRIDE_WIFI_CONFIG" />
<uses-permission android:name="android.permission.MANAGE_NETWORK_POLICY" />
- <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
+ <uses-permission android:name="android.permission.OBSERVE_NETWORK_POLICY" />
<uses-permission android:name="android.permission.NETWORK_SETTINGS" />
<uses-permission android:name="android.permission.TETHER_PRIVILEGED" />
<uses-permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY" />
diff --git a/packages/SystemUI/CleanSpec.mk b/packages/SystemUI/CleanSpec.mk
new file mode 100644
index 0000000..2a2e4e4
--- /dev/null
+++ b/packages/SystemUI/CleanSpec.mk
@@ -0,0 +1,50 @@
+# Copyright (C) 2019 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.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list. These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list. E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# *****************************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THE BANNER
+# *****************************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/product/priv-app/SystemUI)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/product/priv-app/SystemUI)
+# ******************************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
+# ******************************************************************
diff --git a/packages/SystemUI/tests/AndroidManifest.xml b/packages/SystemUI/tests/AndroidManifest.xml
index efb4ff0..a897b00 100644
--- a/packages/SystemUI/tests/AndroidManifest.xml
+++ b/packages/SystemUI/tests/AndroidManifest.xml
@@ -35,7 +35,6 @@
<uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_VR_MANAGER" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
<uses-permission android:name="android.permission.MANAGE_NETWORK_POLICY" />
<uses-permission android:name="android.permission.REQUEST_NETWORK_SCORES" />
<uses-permission android:name="android.permission.CONTROL_VPN" />
diff --git a/packages/Tethering/Android.bp b/packages/Tethering/Android.bp
index d297f3f..1315ed0 100644
--- a/packages/Tethering/Android.bp
+++ b/packages/Tethering/Android.bp
@@ -34,7 +34,7 @@
"framework-tethering",
"unsupportedappusage",
],
-
+ plugins: ["java_api_finder"],
manifest: "AndroidManifestBase.xml",
}
diff --git a/packages/Tethering/src/android/net/ip/IpServer.java b/packages/Tethering/src/android/net/ip/IpServer.java
index 4306cf0b..0491ad7 100644
--- a/packages/Tethering/src/android/net/ip/IpServer.java
+++ b/packages/Tethering/src/android/net/ip/IpServer.java
@@ -441,7 +441,8 @@
}
final Boolean setIfaceUp;
- if (mInterfaceType == TetheringManager.TETHERING_WIFI) {
+ if (mInterfaceType == TetheringManager.TETHERING_WIFI
+ || mInterfaceType == TetheringManager.TETHERING_WIFI_P2P) {
// The WiFi stack has ownership of the interface up/down state.
// It is unclear whether the Bluetooth or USB stacks will manage their own
// state.
diff --git a/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java b/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java
index 26875b1..5bf41ce 100644
--- a/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java
+++ b/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java
@@ -207,6 +207,7 @@
private Network mTetherUpstream;
private TetherStatesParcel mTetherStatesParcel;
private boolean mDataSaverEnabled = false;
+ private String mWifiP2pTetherInterface = null;
public Tethering(TetheringDependencies deps) {
mLog.mark("Tethering.constructed");
@@ -852,6 +853,11 @@
}
}
+ private boolean isGroupOwner(WifiP2pGroup group) {
+ return group != null && group.isGroupOwner()
+ && !TextUtils.isEmpty(group.getInterface());
+ }
+
private void handleWifiP2pAction(Intent intent) {
if (mConfig.isWifiP2pLegacyTetheringMode()) return;
@@ -864,24 +870,31 @@
Log.d(TAG, "WifiP2pAction: P2pInfo: " + p2pInfo + " Group: " + group);
}
- if (p2pInfo == null) return;
- // When a p2p group is disconnected, p2pInfo would be cleared.
- // group is still valid for detecting whether this device is group owner.
- if (group == null || !group.isGroupOwner()
- || TextUtils.isEmpty(group.getInterface())) return;
-
synchronized (Tethering.this.mPublicSync) {
- // Enter below only if this device is Group Owner with a valid interface.
- if (p2pInfo.groupFormed) {
- TetherState tetherState = mTetherStates.get(group.getInterface());
- if (tetherState == null
- || (tetherState.lastState != IpServer.STATE_TETHERED
- && tetherState.lastState != IpServer.STATE_LOCAL_ONLY)) {
- enableWifiIpServingLocked(group.getInterface(), IFACE_IP_MODE_LOCAL_ONLY);
- }
- } else {
- disableWifiP2pIpServingLocked(group.getInterface());
+ // if no group is formed, bring it down if needed.
+ if (p2pInfo == null || !p2pInfo.groupFormed) {
+ disableWifiP2pIpServingLockedIfNeeded(mWifiP2pTetherInterface);
+ mWifiP2pTetherInterface = null;
+ return;
}
+
+ // If there is a group but the device is not the owner, bail out.
+ if (!isGroupOwner(group)) return;
+
+ // If already serving from the correct interface, nothing to do.
+ if (group.getInterface().equals(mWifiP2pTetherInterface)) return;
+
+ // If already serving from another interface, turn it down first.
+ if (!TextUtils.isEmpty(mWifiP2pTetherInterface)) {
+ mLog.w("P2P tethered interface " + mWifiP2pTetherInterface
+ + "is different from current interface "
+ + group.getInterface() + ", re-tether it");
+ disableWifiP2pIpServingLockedIfNeeded(mWifiP2pTetherInterface);
+ }
+
+ // Finally bring up serving on the new interface
+ mWifiP2pTetherInterface = group.getInterface();
+ enableWifiIpServingLocked(mWifiP2pTetherInterface, IFACE_IP_MODE_LOCAL_ONLY);
}
}
@@ -979,7 +992,9 @@
disableWifiIpServingLockedCommon(TETHERING_WIFI, ifname, apState);
}
- private void disableWifiP2pIpServingLocked(String ifname) {
+ private void disableWifiP2pIpServingLockedIfNeeded(String ifname) {
+ if (TextUtils.isEmpty(ifname)) return;
+
disableWifiIpServingLockedCommon(TETHERING_WIFI_P2P, ifname, /* dummy */ 0);
}
diff --git a/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java b/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
index 1f50b6b..f29ad78 100644
--- a/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
+++ b/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
@@ -273,7 +273,7 @@
dispatchCommand(IpServer.CMD_TETHER_REQUESTED, STATE_LOCAL_ONLY);
InOrder inOrder = inOrder(mCallback, mNetd);
inOrder.verify(mNetd).interfaceSetCfg(argThat(cfg ->
- IFACE_NAME.equals(cfg.ifName) && assertContainsFlag(cfg.flags, IF_STATE_UP)));
+ IFACE_NAME.equals(cfg.ifName) && assertNotContainsFlag(cfg.flags, IF_STATE_UP)));
inOrder.verify(mNetd).tetherInterfaceAdd(IFACE_NAME);
inOrder.verify(mNetd).networkAddInterface(INetd.LOCAL_NET_ID, IFACE_NAME);
inOrder.verify(mNetd, times(2)).networkAddRoute(eq(INetd.LOCAL_NET_ID), eq(IFACE_NAME),
@@ -547,4 +547,14 @@
fail("Missing flag: " + match);
return false;
}
+
+ private boolean assertNotContainsFlag(String[] flags, String match) {
+ for (String flag : flags) {
+ if (flag.equals(match)) {
+ fail("Unexpected flag: " + match);
+ return false;
+ }
+ }
+ return true;
+ }
}
diff --git a/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringTest.java b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringTest.java
index dc40800..affd691 100644
--- a/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringTest.java
+++ b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringTest.java
@@ -493,17 +493,21 @@
private void sendWifiP2pConnectionChanged(
boolean isGroupFormed, boolean isGroupOwner, String ifname) {
+ WifiP2pGroup group = null;
WifiP2pInfo p2pInfo = new WifiP2pInfo();
p2pInfo.groupFormed = isGroupFormed;
- p2pInfo.isGroupOwner = isGroupOwner;
+ if (isGroupFormed) {
+ p2pInfo.isGroupOwner = isGroupOwner;
+ group = mock(WifiP2pGroup.class);
+ when(group.isGroupOwner()).thenReturn(isGroupOwner);
+ when(group.getInterface()).thenReturn(ifname);
+ }
- WifiP2pGroup group = new WifiP2pGroup();
- group.setIsGroupOwner(isGroupOwner);
- group.setInterface(ifname);
+ final Intent intent = mock(Intent.class);
+ when(intent.getAction()).thenReturn(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION);
+ when(intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_INFO)).thenReturn(p2pInfo);
+ when(intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_GROUP)).thenReturn(group);
- final Intent intent = new Intent(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION);
- intent.putExtra(WifiP2pManager.EXTRA_WIFI_P2P_INFO, p2pInfo);
- intent.putExtra(WifiP2pManager.EXTRA_WIFI_P2P_GROUP, group);
mServiceContext.sendBroadcastAsUserMultiplePermissions(intent, UserHandle.ALL,
P2P_RECEIVER_PERMISSIONS_FOR_BROADCAST);
}
diff --git a/packages/WAPPushManager/Android.bp b/packages/WAPPushManager/Android.bp
index c391369..083dac9 100644
--- a/packages/WAPPushManager/Android.bp
+++ b/packages/WAPPushManager/Android.bp
@@ -10,5 +10,5 @@
proguard_flags_files: ["proguard.flags"],
},
- product_specific: true,
+ system_ext_specific: true,
}
diff --git a/packages/WAPPushManager/CleanSpec.mk b/packages/WAPPushManager/CleanSpec.mk
index 2dcbb10..f4e316c 100644
--- a/packages/WAPPushManager/CleanSpec.mk
+++ b/packages/WAPPushManager/CleanSpec.mk
@@ -49,3 +49,5 @@
# ************************************************
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/WAPPushManager)
+$(call add-clean-step, rm -rf $(TARGET_OUT_PRODUCT)/app/WAPPushManager)
+
diff --git a/packages/WallpaperCropper/Android.bp b/packages/WallpaperCropper/Android.bp
index 40c4235..ac38b27 100644
--- a/packages/WallpaperCropper/Android.bp
+++ b/packages/WallpaperCropper/Android.bp
@@ -3,7 +3,7 @@
srcs: ["src/**/*.java"],
platform_apis: true,
certificate: "platform",
- product_specific: true,
+ system_ext_specific: true,
privileged: true,
optimize: {
proguard_flags_files: ["proguard.flags"],
diff --git a/packages/WallpaperCropper/CleanSpec.mk b/packages/WallpaperCropper/CleanSpec.mk
index e6d8d5a..f08c343 100644
--- a/packages/WallpaperCropper/CleanSpec.mk
+++ b/packages/WallpaperCropper/CleanSpec.mk
@@ -44,6 +44,7 @@
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/WallpaperCropper)
+$(call add-clean-step, rm -rf $(TARGET_OUT_PRODUCT)/priv-app/WallpaperCropper)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/services/core/java/com/android/server/DynamicSystemService.java b/services/core/java/com/android/server/DynamicSystemService.java
index 7909e30..c60460f 100644
--- a/services/core/java/com/android/server/DynamicSystemService.java
+++ b/services/core/java/com/android/server/DynamicSystemService.java
@@ -44,9 +44,9 @@
private static final String TAG = "DynamicSystemService";
private static final String NO_SERVICE_ERROR = "no gsiservice";
private static final int GSID_ROUGH_TIMEOUT_MS = 8192;
- private static final String PATH_DEFAULT = "/data/gsi";
+ private static final String PATH_DEFAULT = "/data/gsi/";
private Context mContext;
- private String mInstallPath;
+ private String mInstallPath, mDsuSlot;
private volatile IGsiService mGsiService;
DynamicSystemService(Context context) {
@@ -115,7 +115,7 @@
}
@Override
- public boolean startInstallation() throws RemoteException {
+ public boolean startInstallation(String dsuSlot) throws RemoteException {
IGsiService service = getGsiService();
// priority from high to low: sysprop -> sdcard -> /data
String path = SystemProperties.get("os.aot.path");
@@ -129,16 +129,17 @@
if (!Environment.MEDIA_MOUNTED.equals(volume.getState())) continue;
File sdCard = volume.getPathFile();
if (sdCard.isDirectory()) {
- path = sdCard.getPath();
+ path = new File(sdCard, dsuSlot).getPath();
break;
}
}
if (path.isEmpty()) {
- path = PATH_DEFAULT;
+ path = PATH_DEFAULT + dsuSlot;
}
Slog.i(TAG, "startInstallation -> " + path);
}
mInstallPath = path;
+ mDsuSlot = dsuSlot;
if (service.openInstall(path) != 0) {
Slog.i(TAG, "Failed to open " + path);
return false;
@@ -203,7 +204,7 @@
public boolean setEnable(boolean enable, boolean oneShot) throws RemoteException {
IGsiService gsiService = getGsiService();
if (enable) {
- return gsiService.enableGsi(oneShot) == 0;
+ return gsiService.enableGsi(oneShot, mDsuSlot) == 0;
} else {
return gsiService.disableGsi();
}
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index d1bc6af..90b0c11 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -2648,9 +2648,11 @@
*/
@Override
public boolean supportsCheckpoint() throws RemoteException {
- // Only the system process is permitted to start checkpoints
- if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) {
- throw new SecurityException("no permission to check filesystem checkpoint support");
+ // Only the root, system_server and shell processes are permitted to start checkpoints
+ final int callingUid = Binder.getCallingUid();
+ if (callingUid != Process.SYSTEM_UID && callingUid != Process.ROOT_UID
+ && callingUid != Process.SHELL_UID) {
+ throw new SecurityException("no permission to start filesystem checkpoint");
}
return mVold.supportsCheckpoint();
@@ -2665,8 +2667,10 @@
*/
@Override
public void startCheckpoint(int numTries) throws RemoteException {
- // Only the system process is permitted to start checkpoints
- if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) {
+ // Only the root, system_server and shell processes are permitted to start checkpoints
+ final int callingUid = Binder.getCallingUid();
+ if (callingUid != Process.SYSTEM_UID && callingUid != Process.ROOT_UID
+ && callingUid != Process.SHELL_UID) {
throw new SecurityException("no permission to start filesystem checkpoint");
}
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 5f17e5e..8b436c5 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -50,6 +50,13 @@
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
+import android.telephony.CellSignalStrength;
+import android.telephony.CellSignalStrengthCdma;
+import android.telephony.CellSignalStrengthGsm;
+import android.telephony.CellSignalStrengthLte;
+import android.telephony.CellSignalStrengthNr;
+import android.telephony.CellSignalStrengthTdscdma;
+import android.telephony.CellSignalStrengthWcdma;
import android.telephony.DataFailCause;
import android.telephony.DisconnectCause;
import android.telephony.LocationAccessPolicy;
@@ -404,7 +411,11 @@
mVoiceActivationState = copyOf(mVoiceActivationState, mNumPhones);
mDataActivationState = copyOf(mDataActivationState, mNumPhones);
mUserMobileDataState = copyOf(mUserMobileDataState, mNumPhones);
- mSignalStrength = copyOf(mSignalStrength, mNumPhones);
+ if (mSignalStrength != null) {
+ mSignalStrength = copyOf(mSignalStrength, mNumPhones);
+ } else {
+ mSignalStrength = new SignalStrength[mNumPhones];
+ }
mMessageWaiting = copyOf(mMessageWaiting, mNumPhones);
mCallForwarding = copyOf(mCallForwarding, mNumPhones);
mCellIdentity = copyOf(mCellIdentity, mNumPhones);
@@ -438,7 +449,7 @@
mDataActivationState[i] = TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
mCallIncomingNumber[i] = "";
mServiceState[i] = new ServiceState();
- mSignalStrength[i] = new SignalStrength();
+ mSignalStrength[i] = null;
mUserMobileDataState[i] = false;
mMessageWaiting[i] = false;
mCallForwarding[i] = false;
@@ -522,7 +533,7 @@
mDataActivationState[i] = TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
mCallIncomingNumber[i] = "";
mServiceState[i] = new ServiceState();
- mSignalStrength[i] = new SignalStrength();
+ mSignalStrength[i] = null;
mUserMobileDataState[i] = false;
mMessageWaiting[i] = false;
mCallForwarding[i] = false;
@@ -799,10 +810,12 @@
}
if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTH) != 0) {
try {
- int gsmSignalStrength = mSignalStrength[phoneId]
- .getGsmSignalStrength();
- r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
- : gsmSignalStrength));
+ if (mSignalStrength[phoneId] != null) {
+ int gsmSignalStrength = mSignalStrength[phoneId]
+ .getGsmSignalStrength();
+ r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
+ : gsmSignalStrength));
+ }
} catch (RemoteException ex) {
remove(r.binder);
}
@@ -859,7 +872,9 @@
}
if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) != 0) {
try {
- r.callback.onSignalStrengthsChanged(mSignalStrength[phoneId]);
+ if (mSignalStrength[phoneId] != null) {
+ r.callback.onSignalStrengthsChanged(mSignalStrength[phoneId]);
+ }
} catch (RemoteException ex) {
remove(r.binder);
}
@@ -1596,7 +1611,7 @@
TelephonyManager.DATA_UNKNOWN,
TelephonyManager.NETWORK_TYPE_UNKNOWN,
ApnSetting.getApnTypesBitmaskFromString(apnType), null, null,
- DataFailCause.NONE));
+ DataFailCause.NONE, null));
for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)
@@ -1781,7 +1796,7 @@
TelephonyManager.DATA_UNKNOWN,
TelephonyManager.NETWORK_TYPE_UNKNOWN,
ApnSetting.getApnTypesBitmaskFromString(apnType), null, null,
- failCause));
+ failCause, null));
for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)
@@ -2204,13 +2219,32 @@
Intent intent = new Intent(TelephonyIntents.ACTION_SIGNAL_STRENGTH_CHANGED);
Bundle data = new Bundle();
- signalStrength.fillInNotifierBundle(data);
+ fillInSignalStrengthNotifierBundle(signalStrength, data);
intent.putExtras(data);
intent.putExtra(PHONE_CONSTANTS_SUBSCRIPTION_KEY, subId);
intent.putExtra(PHONE_CONSTANTS_SLOT_KEY, phoneId);
mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
}
+ private void fillInSignalStrengthNotifierBundle(SignalStrength signalStrength, Bundle bundle) {
+ List<CellSignalStrength> cellSignalStrengths = signalStrength.getCellSignalStrengths();
+ for (CellSignalStrength cellSignalStrength : cellSignalStrengths) {
+ if (cellSignalStrength instanceof CellSignalStrengthLte) {
+ bundle.putParcelable("Lte", (CellSignalStrengthLte) cellSignalStrength);
+ } else if (cellSignalStrength instanceof CellSignalStrengthCdma) {
+ bundle.putParcelable("Cdma", (CellSignalStrengthCdma) cellSignalStrength);
+ } else if (cellSignalStrength instanceof CellSignalStrengthGsm) {
+ bundle.putParcelable("Gsm", (CellSignalStrengthGsm) cellSignalStrength);
+ } else if (cellSignalStrength instanceof CellSignalStrengthWcdma) {
+ bundle.putParcelable("Wcdma", (CellSignalStrengthWcdma) cellSignalStrength);
+ } else if (cellSignalStrength instanceof CellSignalStrengthTdscdma) {
+ bundle.putParcelable("Tdscdma", (CellSignalStrengthTdscdma) cellSignalStrength);
+ } else if (cellSignalStrength instanceof CellSignalStrengthNr) {
+ bundle.putParcelable("Nr", (CellSignalStrengthNr) cellSignalStrength);
+ }
+ }
+ }
+
/**
* Broadcasts an intent notifying apps of a phone state change. {@code subId} can be
* a valid subId, in which case this function fires a subId-specific intent, or it
@@ -2519,11 +2553,14 @@
if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) != 0) {
try {
- SignalStrength signalStrength = mSignalStrength[phoneId];
- if (DBG) {
- log("checkPossibleMissNotify: onSignalStrengthsChanged SS=" + signalStrength);
+ if (mSignalStrength[phoneId] != null) {
+ SignalStrength signalStrength = mSignalStrength[phoneId];
+ if (DBG) {
+ log("checkPossibleMissNotify: onSignalStrengthsChanged SS="
+ + signalStrength);
+ }
+ r.callback.onSignalStrengthsChanged(new SignalStrength(signalStrength));
}
- r.callback.onSignalStrengthsChanged(new SignalStrength(signalStrength));
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
@@ -2531,14 +2568,16 @@
if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTH) != 0) {
try {
- int gsmSignalStrength = mSignalStrength[phoneId]
- .getGsmSignalStrength();
- if (DBG) {
- log("checkPossibleMissNotify: onSignalStrengthChanged SS=" +
- gsmSignalStrength);
+ if (mSignalStrength[phoneId] != null) {
+ int gsmSignalStrength = mSignalStrength[phoneId]
+ .getGsmSignalStrength();
+ if (DBG) {
+ log("checkPossibleMissNotify: onSignalStrengthChanged SS="
+ + gsmSignalStrength);
+ }
+ r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
+ : gsmSignalStrength));
}
- r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
- : gsmSignalStrength));
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index a1480e3..e7179e0 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -60,7 +60,6 @@
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.util.DebugUtils;
-import android.util.Pair;
import android.util.Slog;
import android.util.SparseArray;
import android.util.StatsLog;
@@ -162,8 +161,7 @@
private int mHapticFeedbackIntensity;
private int mNotificationIntensity;
private int mRingIntensity;
- private SparseArray<Pair<VibrationEffect, AudioAttributes>> mAlwaysOnEffects =
- new SparseArray<>();
+ private SparseArray<Vibration> mAlwaysOnEffects = new SparseArray<>();
static native boolean vibratorExists();
static native void vibratorInit();
@@ -477,6 +475,10 @@
Settings.System.getUriFor(Settings.System.RING_VIBRATION_INTENSITY),
true, mSettingObserver, UserHandle.USER_ALL);
+ mContext.getContentResolver().registerContentObserver(
+ Settings.Global.getUriFor(Settings.Global.ZEN_MODE),
+ true, mSettingObserver, UserHandle.USER_ALL);
+
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -524,7 +526,8 @@
}
@Override // Binder call
- public boolean setAlwaysOnEffect(int id, VibrationEffect effect, AudioAttributes attrs) {
+ public boolean setAlwaysOnEffect(int uid, String opPkg, int alwaysOnId, VibrationEffect effect,
+ AudioAttributes attrs) {
if (!hasPermission(android.Manifest.permission.VIBRATE_ALWAYS_ON)) {
throw new SecurityException("Requires VIBRATE_ALWAYS_ON permission");
}
@@ -534,8 +537,8 @@
}
if (effect == null) {
synchronized (mLock) {
- mAlwaysOnEffects.delete(id);
- vibratorAlwaysOnDisable(id);
+ mAlwaysOnEffects.delete(alwaysOnId);
+ vibratorAlwaysOnDisable(alwaysOnId);
}
} else {
if (!verifyVibrationEffect(effect)) {
@@ -545,14 +548,11 @@
Slog.e(TAG, "Only prebaked effects supported for always-on.");
return false;
}
- if (attrs == null) {
- attrs = new AudioAttributes.Builder()
- .setUsage(AudioAttributes.USAGE_UNKNOWN)
- .build();
- }
+ attrs = fixupVibrationAttributes(attrs);
synchronized (mLock) {
- mAlwaysOnEffects.put(id, Pair.create(effect, attrs));
- updateAlwaysOnLocked(id, effect, attrs);
+ Vibration vib = new Vibration(null, effect, attrs, uid, opPkg, null);
+ mAlwaysOnEffects.put(alwaysOnId, vib);
+ updateAlwaysOnLocked(alwaysOnId, vib);
}
}
return true;
@@ -592,6 +592,25 @@
return true;
}
+ private AudioAttributes fixupVibrationAttributes(AudioAttributes attrs) {
+ if (attrs == null) {
+ attrs = new AudioAttributes.Builder()
+ .setUsage(AudioAttributes.USAGE_UNKNOWN)
+ .build();
+ }
+ if (shouldBypassDnd(attrs)) {
+ if (!(hasPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
+ || hasPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
+ || hasPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING))) {
+ final int flags = attrs.getAllFlags()
+ & ~AudioAttributes.FLAG_BYPASS_INTERRUPTION_POLICY;
+ attrs = new AudioAttributes.Builder(attrs).replaceFlags(flags).build();
+ }
+ }
+
+ return attrs;
+ }
+
private static long[] getLongIntArray(Resources r, int resid) {
int[] ar = r.getIntArray(resid);
if (ar == null) {
@@ -621,21 +640,7 @@
return;
}
- if (attrs == null) {
- attrs = new AudioAttributes.Builder()
- .setUsage(AudioAttributes.USAGE_UNKNOWN)
- .build();
- }
-
- if (shouldBypassDnd(attrs)) {
- if (!(hasPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
- || hasPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
- || hasPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING))) {
- final int flags = attrs.getAllFlags()
- & ~AudioAttributes.FLAG_BYPASS_INTERRUPTION_POLICY;
- attrs = new AudioAttributes.Builder(attrs).replaceFlags(flags).build();
- }
- }
+ attrs = fixupVibrationAttributes(attrs);
// If our current vibration is longer than the new vibration and is the same amplitude,
// then just let the current one finish.
@@ -796,29 +801,8 @@
private void startVibrationLocked(final Vibration vib) {
Trace.traceBegin(Trace.TRACE_TAG_VIBRATOR, "startVibrationLocked");
try {
- if (!isAllowedToVibrateLocked(vib)) {
- return;
- }
-
final int intensity = getCurrentIntensityLocked(vib);
- if (intensity == Vibrator.VIBRATION_INTENSITY_OFF) {
- return;
- }
-
- if (vib.isRingtone() && !shouldVibrateForRingtone()) {
- if (DEBUG) {
- Slog.e(TAG, "Vibrate ignored, not vibrating for ringtones");
- }
- return;
- }
-
- final int mode = getAppOpMode(vib);
- if (mode != AppOpsManager.MODE_ALLOWED) {
- if (mode == AppOpsManager.MODE_ERRORED) {
- // We might be getting calls from within system_server, so we don't actually
- // want to throw a SecurityException here.
- Slog.w(TAG, "Would be an error: vibrate from uid " + vib.uid);
- }
+ if (!shouldVibrate(vib, intensity)) {
return;
}
applyVibrationIntensityScalingLocked(vib, intensity);
@@ -985,6 +969,35 @@
return mode;
}
+ private boolean shouldVibrate(Vibration vib, int intensity) {
+ if (!isAllowedToVibrateLocked(vib)) {
+ return false;
+ }
+
+ if (intensity == Vibrator.VIBRATION_INTENSITY_OFF) {
+ return false;
+ }
+
+ if (vib.isRingtone() && !shouldVibrateForRingtone()) {
+ if (DEBUG) {
+ Slog.e(TAG, "Vibrate ignored, not vibrating for ringtones");
+ }
+ return false;
+ }
+
+ final int mode = getAppOpMode(vib);
+ if (mode != AppOpsManager.MODE_ALLOWED) {
+ if (mode == AppOpsManager.MODE_ERRORED) {
+ // We might be getting calls from within system_server, so we don't actually
+ // want to throw a SecurityException here.
+ Slog.w(TAG, "Would be an error: vibrate from uid " + vib.uid);
+ }
+ return false;
+ }
+
+ return true;
+ }
+
@GuardedBy("mLock")
private void reportFinishVibrationLocked() {
Trace.traceBegin(Trace.TRACE_TAG_VIBRATOR, "reportFinishVibrationLocked");
@@ -1096,14 +1109,12 @@
mVibrator.getDefaultRingVibrationIntensity(), UserHandle.USER_CURRENT);
}
- private void updateAlwaysOnLocked(int id, VibrationEffect effect, AudioAttributes attrs) {
- // TODO: Check DND and LowPower settings
- final Vibration vib = new Vibration(null, effect, attrs, 0, null, null);
+ private void updateAlwaysOnLocked(int id, Vibration vib) {
final int intensity = getCurrentIntensityLocked(vib);
- if (intensity == Vibrator.VIBRATION_INTENSITY_OFF) {
+ if (!shouldVibrate(vib, intensity)) {
vibratorAlwaysOnDisable(id);
} else {
- final VibrationEffect.Prebaked prebaked = (VibrationEffect.Prebaked) effect;
+ final VibrationEffect.Prebaked prebaked = (VibrationEffect.Prebaked) vib.effect;
final int strength = intensityToEffectStrength(intensity);
vibratorAlwaysOnEnable(id, prebaked.getId(), strength);
}
@@ -1112,8 +1123,8 @@
private void updateAlwaysOnLocked() {
for (int i = 0; i < mAlwaysOnEffects.size(); i++) {
int id = mAlwaysOnEffects.keyAt(i);
- Pair<VibrationEffect, AudioAttributes> pair = mAlwaysOnEffects.valueAt(i);
- updateAlwaysOnLocked(id, pair.first, pair.second);
+ Vibration vib = mAlwaysOnEffects.valueAt(i);
+ updateAlwaysOnLocked(id, vib);
}
}
diff --git a/services/core/java/com/android/server/compat/OverrideValidatorImpl.java b/services/core/java/com/android/server/compat/OverrideValidatorImpl.java
index dfc0080..4bf606e 100644
--- a/services/core/java/com/android/server/compat/OverrideValidatorImpl.java
+++ b/services/core/java/com/android/server/compat/OverrideValidatorImpl.java
@@ -53,6 +53,7 @@
public OverrideAllowedState getOverrideAllowedState(long changeId, String packageName) {
boolean debuggableBuild = false;
boolean finalBuild = false;
+ int minTargetSdk = mCompatConfig.minTargetSdkForChangeId(changeId);
debuggableBuild = mAndroidBuildClassifier.isDebuggableBuild();
finalBuild = mAndroidBuildClassifier.isFinalBuild();
@@ -76,15 +77,14 @@
if ((applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
return new OverrideAllowedState(DISABLED_NOT_DEBUGGABLE, -1, -1);
}
- int minTargetSdk = mCompatConfig.minTargetSdkForChangeId(changeId);
- // Do not allow overriding non-target sdk gated changes on user builds
- if (minTargetSdk == -1) {
- return new OverrideAllowedState(DISABLED_NON_TARGET_SDK, appTargetSdk, minTargetSdk);
- }
// Allow overriding any change for debuggable apps on non-final builds.
if (!finalBuild) {
return new OverrideAllowedState(ALLOWED, appTargetSdk, minTargetSdk);
}
+ // Do not allow overriding non-target sdk gated changes on user builds
+ if (minTargetSdk == -1) {
+ return new OverrideAllowedState(DISABLED_NON_TARGET_SDK, appTargetSdk, minTargetSdk);
+ }
// Only allow to opt-in for a targetSdk gated change.
if (applicationInfo.targetSdkVersion < minTargetSdk) {
return new OverrideAllowedState(ALLOWED, appTargetSdk, minTargetSdk);
diff --git a/services/core/java/com/android/server/pm/StagingManager.java b/services/core/java/com/android/server/pm/StagingManager.java
index 2705455..349a003 100644
--- a/services/core/java/com/android/server/pm/StagingManager.java
+++ b/services/core/java/com/android/server/pm/StagingManager.java
@@ -41,6 +41,7 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
+import android.os.ParcelableException;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -414,29 +415,28 @@
} else {
params.installFlags |= PackageManager.INSTALL_DISABLE_VERIFICATION;
}
- int apkSessionId = mPi.createSession(
- params, originalSession.getInstallerPackageName(),
- 0 /* UserHandle.SYSTEM */);
- PackageInstallerSession apkSession = mPi.getSession(apkSessionId);
-
try {
+ int apkSessionId = mPi.createSession(
+ params, originalSession.getInstallerPackageName(),
+ 0 /* UserHandle.SYSTEM */);
+ PackageInstallerSession apkSession = mPi.getSession(apkSessionId);
apkSession.open();
for (String apkFilePath : apkFilePaths) {
File apkFile = new File(apkFilePath);
ParcelFileDescriptor pfd = ParcelFileDescriptor.open(apkFile,
ParcelFileDescriptor.MODE_READ_ONLY);
- long sizeBytes = pfd.getStatSize();
+ long sizeBytes = (pfd == null) ? -1 : pfd.getStatSize();
if (sizeBytes < 0) {
Slog.e(TAG, "Unable to get size of: " + apkFilePath);
return null;
}
apkSession.write(apkFile.getName(), 0, sizeBytes, pfd);
}
- } catch (IOException e) {
+ return apkSession;
+ } catch (IOException | ParcelableException e) {
Slog.e(TAG, "Failure to install APK staged session " + originalSession.sessionId, e);
return null;
}
- return apkSession;
}
private boolean commitApkSession(@NonNull PackageInstallerSession apkSession,
diff --git a/services/core/jni/com_android_server_net_NetworkStatsFactory.cpp b/services/core/jni/com_android_server_net_NetworkStatsFactory.cpp
index 9cd743b..8b6526f 100644
--- a/services/core/jni/com_android_server_net_NetworkStatsFactory.cpp
+++ b/services/core/jni/com_android_server_net_NetworkStatsFactory.cpp
@@ -20,6 +20,7 @@
#include <inttypes.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <vector>
#include <jni.h>
diff --git a/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
index 50437b4..d367f71 100644
--- a/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
@@ -36,7 +36,7 @@
public void test1() {
assertTrue("dynamic_system service available", mService != null);
try {
- mService.startInstallation();
+ mService.startInstallation("dsu");
fail("DynamicSystemService did not throw SecurityException as expected");
} catch (SecurityException e) {
// expected
diff --git a/services/tests/servicestests/src/com/android/server/compat/OverrideValidatorImplTest.java b/services/tests/servicestests/src/com/android/server/compat/OverrideValidatorImplTest.java
index ecd07bd..b14291b 100644
--- a/services/tests/servicestests/src/com/android/server/compat/OverrideValidatorImplTest.java
+++ b/services/tests/servicestests/src/com/android/server/compat/OverrideValidatorImplTest.java
@@ -188,7 +188,7 @@
}
@Test
- public void getOverrideAllowedState_betaBuildEnabledChangeDebugApp_rejectOverride()
+ public void getOverrideAllowedState_betaBuildEnabledChangeDebugApp_allowOverride()
throws Exception {
CompatConfig config = CompatConfigBuilder.create(betaBuild(), mContext)
.addEnabledChangeWithId(1).build();
@@ -203,11 +203,11 @@
overrideValidator.getOverrideAllowedState(1, PACKAGE_NAME);
assertThat(allowedState)
- .isEqualTo(new OverrideAllowedState(DISABLED_NON_TARGET_SDK, -1, -1));
+ .isEqualTo(new OverrideAllowedState(ALLOWED, -1, -1));
}
@Test
- public void getOverrideAllowedState_betaBuildDisabledChangeDebugApp_rejectOverride()
+ public void getOverrideAllowedState_betaBuildDisabledChangeDebugApp_allowOverride()
throws Exception {
CompatConfig config = CompatConfigBuilder.create(betaBuild(), mContext)
.addDisabledChangeWithId(1).build();
@@ -221,7 +221,7 @@
overrideValidator.getOverrideAllowedState(1, PACKAGE_NAME);
assertThat(allowedState)
- .isEqualTo(new OverrideAllowedState(DISABLED_NON_TARGET_SDK, -1, -1));
+ .isEqualTo(new OverrideAllowedState(ALLOWED, -1, -1));
}
@Test
diff --git a/telephony/java/android/telephony/AccessNetworkConstants.java b/telephony/java/android/telephony/AccessNetworkConstants.java
index bb28df2..d325cd8 100644
--- a/telephony/java/android/telephony/AccessNetworkConstants.java
+++ b/telephony/java/android/telephony/AccessNetworkConstants.java
@@ -50,18 +50,12 @@
/**
* Transport type for Wireless Wide Area Networks (i.e. Cellular)
- * @hide
*/
- @SystemApi
- @TestApi
public static final int TRANSPORT_TYPE_WWAN = 1;
/**
* Transport type for Wireless Local Area Networks (i.e. Wifi)
- * @hide
*/
- @SystemApi
- @TestApi
public static final int TRANSPORT_TYPE_WLAN = 2;
/** @hide */
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index cfa4691..61e67be 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1576,7 +1576,10 @@
public static final String KEY_MMS_UA_PROF_TAG_NAME_STRING = "uaProfTagName";
public static final String KEY_MMS_UA_PROF_URL_STRING = "uaProfUrl";
public static final String KEY_MMS_USER_AGENT_STRING = "userAgent";
- /** @hide */
+ /**
+ * If true, add "Connection: close" header to MMS HTTP requests so the connection
+ * is immediately closed (disabling keep-alive).
+ */
public static final String KEY_MMS_CLOSE_CONNECTION_BOOL = "mmsCloseConnection";
/**
@@ -3518,7 +3521,7 @@
sDefaults.putInt(KEY_IMS_DTMF_TONE_DELAY_INT, 0);
sDefaults.putInt(KEY_CDMA_DTMF_TONE_DELAY_INT, 100);
sDefaults.putBoolean(KEY_CALL_FORWARDING_MAP_NON_NUMBER_TO_VOICEMAIL_BOOL, false);
- sDefaults.putBoolean(KEY_IGNORE_RTT_MODE_SETTING_BOOL, true);
+ sDefaults.putBoolean(KEY_IGNORE_RTT_MODE_SETTING_BOOL, false);
sDefaults.putInt(KEY_CDMA_3WAYCALL_FLASH_DELAY_INT , 0);
sDefaults.putBoolean(KEY_SUPPORT_CONFERENCE_CALL_BOOL, true);
sDefaults.putBoolean(KEY_SUPPORT_IMS_CONFERENCE_CALL_BOOL, true);
diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java
index 475c99b..ec86c14 100644
--- a/telephony/java/android/telephony/CellInfo.java
+++ b/telephony/java/android/telephony/CellInfo.java
@@ -18,6 +18,7 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.SuppressLint;
import android.compat.annotation.UnsupportedAppUsage;
import android.hardware.radio.V1_4.CellInfo.Info;
import android.os.Parcel;
@@ -179,6 +180,18 @@
*
* @return a time stamp in nanos since boot.
*/
+ @SuppressLint("MethodNameUnits")
+ public long getTimestampNanos() {
+ return mTimeStamp;
+ }
+
+ /**
+ * Approximate time this cell information was received from the modem.
+ *
+ * @return a time stamp in nanos since boot.
+ * @deprecated Use {@link #getTimestampNanos} instead.
+ */
+ @Deprecated
public long getTimeStamp() {
return mTimeStamp;
}
diff --git a/telephony/java/android/telephony/NetworkRegistrationInfo.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java
index cbd5ed6..32ffb75 100644
--- a/telephony/java/android/telephony/NetworkRegistrationInfo.java
+++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java
@@ -36,10 +36,7 @@
/**
* Description of a mobile network registration info
- * @hide
*/
-@SystemApi
-@TestApi
public final class NetworkRegistrationInfo implements Parcelable {
/**
* Network domain
@@ -51,9 +48,9 @@
/** Unknown / Unspecified domain */
public static final int DOMAIN_UNKNOWN = 0;
- /** Circuit switching domain */
+ /** Circuit switched domain */
public static final int DOMAIN_CS = android.hardware.radio.V1_5.Domain.CS;
- /** Packet switching domain */
+ /** Packet switched domain */
public static final int DOMAIN_PS = android.hardware.radio.V1_5.Domain.PS;
/** Applicable to both CS and PS Domain */
public static final int DOMAIN_CS_PS = DOMAIN_CS | DOMAIN_PS;
@@ -69,17 +66,41 @@
REGISTRATION_STATE_UNKNOWN, REGISTRATION_STATE_ROAMING})
public @interface RegistrationState {}
- /** Not registered. The device is not currently searching a new operator to register. */
+ /**
+ * Not registered. The device is not currently searching a new operator to register.
+ * @hide
+ */
+ @SystemApi @TestApi
public static final int REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING = 0;
- /** Registered on home network. */
+ /**
+ * Registered on home network.
+ * @hide
+ */
+ @SystemApi @TestApi
public static final int REGISTRATION_STATE_HOME = 1;
- /** Not registered. The device is currently searching a new operator to register. */
+ /**
+ * Not registered. The device is currently searching a new operator to register.
+ * @hide
+ */
+ @SystemApi @TestApi
public static final int REGISTRATION_STATE_NOT_REGISTERED_SEARCHING = 2;
- /** Registration denied. */
+ /**
+ * Registration denied.
+ * @hide
+ */
+ @SystemApi @TestApi
public static final int REGISTRATION_STATE_DENIED = 3;
- /** Registration state is unknown. */
+ /**
+ * Registration state is unknown.
+ * @hide
+ */
+ @SystemApi @TestApi
public static final int REGISTRATION_STATE_UNKNOWN = 4;
- /** Registered on roaming network. */
+ /**
+ * Registered on roaming network.
+ * @hide
+ */
+ @SystemApi @TestApi
public static final int REGISTRATION_STATE_ROAMING = 5;
/** @hide */
@@ -92,7 +113,6 @@
/**
* The device isn't camped on an LTE cell or the LTE cell doesn't support E-UTRA-NR
* Dual Connectivity(EN-DC).
- * @hide
*/
public static final int NR_STATE_NONE = 0;
@@ -100,7 +120,6 @@
* The device is camped on an LTE cell that supports E-UTRA-NR Dual Connectivity(EN-DC) but
* either the use of dual connectivity with NR(DCNR) is restricted or NR is not supported by
* the selected PLMN.
- * @hide
*/
public static final int NR_STATE_RESTRICTED = 1;
@@ -108,14 +127,12 @@
* The device is camped on an LTE cell that supports E-UTRA-NR Dual Connectivity(EN-DC) and both
* the use of dual connectivity with NR(DCNR) is not restricted and NR is supported by the
* selected PLMN.
- * @hide
*/
public static final int NR_STATE_NOT_RESTRICTED = 2;
/**
* The device is camped on an LTE cell that supports E-UTRA-NR Dual Connectivity(EN-DC) and
* also connected to at least one 5G cell as a secondary serving cell.
- * @hide
*/
public static final int NR_STATE_CONNECTED = 3;
@@ -129,22 +146,34 @@
SERVICE_TYPE_VIDEO, SERVICE_TYPE_EMERGENCY})
public @interface ServiceType {}
- /** Unkown service */
+ /**
+ * Unknown service
+ */
public static final int SERVICE_TYPE_UNKNOWN = 0;
- /** Voice service */
+ /**
+ * Voice service
+ */
public static final int SERVICE_TYPE_VOICE = 1;
- /** Data service */
+ /**
+ * Data service
+ */
public static final int SERVICE_TYPE_DATA = 2;
- /** SMS service */
+ /**
+ * SMS service
+ */
public static final int SERVICE_TYPE_SMS = 3;
- /** Video service */
+ /**
+ * Video service
+ */
public static final int SERVICE_TYPE_VIDEO = 4;
- /** Emergency service */
+ /**
+ * Emergency service
+ */
public static final int SERVICE_TYPE_EMERGENCY = 5;
@Domain
@@ -330,9 +359,7 @@
* Get the 5G NR connection state.
*
* @return the 5G NR connection state.
- * @hide
*/
- @SystemApi
public @NRState int getNrState() {
return mNrState;
}
@@ -344,7 +371,10 @@
/**
* @return The registration state.
+ *
+ * @hide
*/
+ @SystemApi @TestApi
public @RegistrationState int getRegistrationState() {
return mRegistrationState;
}
@@ -352,6 +382,21 @@
/**
* @return {@code true} if registered on roaming network, {@code false} otherwise.
*/
+ public boolean isRegistered() {
+ return mRegistrationState == REGISTRATION_STATE_HOME
+ || mRegistrationState == REGISTRATION_STATE_ROAMING;
+ }
+
+ /**
+ * @return {@code true} if registered on roaming network, {@code false} otherwise.
+ */
+ public boolean isSearching() {
+ return mRegistrationState == REGISTRATION_STATE_NOT_REGISTERED_SEARCHING;
+ }
+
+ /**
+ * @return {@code true} if registered on roaming network, {@code false} otherwise.
+ */
public boolean isRoaming() {
return mRoamingType != ServiceState.ROAMING_TYPE_NOT_ROAMING;
}
@@ -376,15 +421,18 @@
/**
* @return the current network roaming type.
+ * @hide
*/
-
+ @SystemApi @TestApi
public @ServiceState.RoamingType int getRoamingType() {
return mRoamingType;
}
/**
* @return Whether emergency is enabled.
+ * @hide
*/
+ @SystemApi @TestApi
public boolean isEmergencyEnabled() { return mEmergencyOnly; }
/**
@@ -422,7 +470,9 @@
* @return Reason for denial if the registration state is {@link #REGISTRATION_STATE_DENIED}.
* Depending on {@code accessNetworkTechnology}, the values are defined in 3GPP TS 24.008
* 10.5.3.6 for UMTS, 3GPP TS 24.301 9.9.3.9 for LTE, and 3GPP2 A.S0001 6.2.2.44 for CDMA
+ * @hide
*/
+ @SystemApi @TestApi
public int getRejectCause() {
return mRejectCause;
}
@@ -445,8 +495,10 @@
/**
* @return Data registration related info
+ * @hide
*/
@Nullable
+ @SystemApi @TestApi
public DataSpecificRegistrationInfo getDataSpecificInfo() {
return mDataSpecificInfo;
}
@@ -571,7 +623,11 @@
&& mNrState == other.mNrState;
}
+ /**
+ * @hide
+ */
@Override
+ @SystemApi @TestApi
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mDomain);
dest.writeInt(mTransportType);
@@ -659,7 +715,9 @@
* .setRegistrationState(REGISTRATION_STATE_HOME)
* .build();
* </code></pre>
+ * @hide
*/
+ @SystemApi @TestApi
public static final class Builder {
@Domain
private int mDomain;
@@ -759,7 +817,9 @@
* @param emergencyOnly True if this network registration is for emergency use only.
*
* @return The same instance of the builder.
+ * @hide
*/
+ @SystemApi @TestApi
public @NonNull Builder setEmergencyOnly(boolean emergencyOnly) {
mEmergencyOnly = emergencyOnly;
return this;
@@ -771,7 +831,9 @@
* @param availableServices Available services.
*
* @return The same instance of the builder.
+ * @hide
*/
+ @SystemApi @TestApi
public @NonNull Builder setAvailableServices(
@NonNull @ServiceType List<Integer> availableServices) {
mAvailableServices = availableServices;
@@ -784,7 +846,9 @@
* @param cellIdentity The cell identity.
*
* @return The same instance of the builder.
+ * @hide
*/
+ @SystemApi @TestApi
public @NonNull Builder setCellIdentity(@Nullable CellIdentity cellIdentity) {
mCellIdentity = cellIdentity;
return this;
@@ -792,9 +856,10 @@
/**
* Build the NetworkRegistrationInfo.
- *
* @return the NetworkRegistrationInfo object.
+ * @hide
*/
+ @SystemApi @TestApi
public @NonNull NetworkRegistrationInfo build() {
return new NetworkRegistrationInfo(mDomain, mTransportType, mRegistrationState,
mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
diff --git a/telephony/java/android/telephony/PreciseDataConnectionState.java b/telephony/java/android/telephony/PreciseDataConnectionState.java
index 4c090b8..31434c1 100644
--- a/telephony/java/android/telephony/PreciseDataConnectionState.java
+++ b/telephony/java/android/telephony/PreciseDataConnectionState.java
@@ -81,18 +81,20 @@
/**
- * Constructor
+ * Constructor of PreciseDataConnectionState
*
* @param state the state of the data connection
* @param networkType the access network that is/would carry this data connection
* @param apnTypes the APN types that this data connection carries
- * @param apnSetting if there is a valid APN for this Data Connection, then the APN Settings;
- * if there is no valid APN setting for the specific type, then this will be null
+ * @param apn the APN of this data connection
* @param linkProperties if the data connection is connected, the properties of the connection
* @param failCause in case a procedure related to this data connection fails, a non-zero error
* code indicating the cause of the failure.
+ * @param apnSetting if there is a valid APN for this Data Connection, then the APN Settings;
+ * if there is no valid APN setting for the specific type, then this will be null
* @hide
*/
+ @SystemApi
public PreciseDataConnectionState(@DataState int state,
@NetworkType int networkType,
@ApnType int apnTypes, @NonNull String apn,
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index ad8ac76..ed003ed 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -16,8 +16,6 @@
package android.telephony;
-import com.android.telephony.Rlog;
-
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -36,6 +34,8 @@
import android.telephony.NetworkRegistrationInfo.NRState;
import android.text.TextUtils;
+import com.android.telephony.Rlog;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
@@ -584,8 +584,8 @@
*/
@DuplexMode
public int getDuplexMode() {
- // only support LTE duplex mode
- if (!isLte(getRilDataRadioTechnology())) {
+ // support LTE/NR duplex mode
+ if (!isPsOnlyTech(getRilDataRadioTechnology())) {
return DUPLEX_MODE_UNKNOWN;
}
@@ -1718,9 +1718,10 @@
}
/** @hide */
- public static boolean isLte(int radioTechnology) {
- return radioTechnology == RIL_RADIO_TECHNOLOGY_LTE ||
- radioTechnology == RIL_RADIO_TECHNOLOGY_LTE_CA;
+ public static boolean isPsOnlyTech(int radioTechnology) {
+ return radioTechnology == RIL_RADIO_TECHNOLOGY_LTE
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_LTE_CA
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_NR;
}
/** @hide */
@@ -1836,10 +1837,8 @@
* Get all of the available network registration info.
*
* @return List of {@link NetworkRegistrationInfo}
- * @hide
*/
@NonNull
- @SystemApi
public List<NetworkRegistrationInfo> getNetworkRegistrationInfoList() {
synchronized (mNetworkRegistrationInfos) {
List<NetworkRegistrationInfo> newList = new ArrayList<>();
diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java
index 4ff1aab..483ccc4 100644
--- a/telephony/java/android/telephony/SignalStrength.java
+++ b/telephony/java/android/telephony/SignalStrength.java
@@ -16,15 +16,18 @@
package android.telephony;
-import com.android.telephony.Rlog;
-
import android.annotation.NonNull;
+import android.annotation.SuppressLint;
+import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PersistableBundle;
+import android.os.SystemClock;
+
+import com.android.telephony.Rlog;
import java.util.ArrayList;
import java.util.List;
@@ -76,6 +79,9 @@
/* The type of signal measurement */
private static final String MEASUREMENT_TYPE_RSCP = "rscp";
+ // timeStamp of signalStrength in nanoseconds since boot
+ private long mTimestamp = Long.MAX_VALUE;
+
CellSignalStrengthCdma mCdma;
CellSignalStrengthGsm mGsm;
CellSignalStrengthWcdma mWcdma;
@@ -134,6 +140,7 @@
mTdscdma = tdscdma;
mLte = lte;
mNr = nr;
+ mTimestamp = SystemClock.elapsedRealtimeNanos();
}
/**
@@ -268,6 +275,7 @@
mTdscdma.updateLevel(cc, ss);
mLte.updateLevel(cc, ss);
mNr.updateLevel(cc, ss);
+ mTimestamp = SystemClock.elapsedRealtimeNanos();
}
/**
@@ -277,8 +285,8 @@
*
* @hide
*/
- @UnsupportedAppUsage
- public SignalStrength(SignalStrength s) {
+ @SystemApi
+ public SignalStrength(@NonNull SignalStrength s) {
copyFrom(s);
}
@@ -293,6 +301,7 @@
mTdscdma = new CellSignalStrengthTdscdma(s.mTdscdma);
mLte = new CellSignalStrengthLte(s.mLte);
mNr = new CellSignalStrengthNr(s.mNr);
+ mTimestamp = s.getTimestampNanos();
}
/**
@@ -310,6 +319,7 @@
mTdscdma = in.readParcelable(CellSignalStrengthTdscdma.class.getClassLoader());
mLte = in.readParcelable(CellSignalStrengthLte.class.getClassLoader());
mNr = in.readParcelable(CellSignalStrengthLte.class.getClassLoader());
+ mTimestamp = in.readLong();
}
/**
@@ -322,9 +332,18 @@
out.writeParcelable(mTdscdma, flags);
out.writeParcelable(mLte, flags);
out.writeParcelable(mNr, flags);
+ out.writeLong(mTimestamp);
}
/**
+ * @return mTimestamp in nanoseconds
+ */
+ @SuppressLint("MethodNameUnits")
+ public long getTimestampNanos() {
+ return mTimestamp;
+ }
+
+ /**
* {@link Parcelable#describeContents}
*/
public int describeContents() {
diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java
index db90550..b5dea7c 100644
--- a/telephony/java/android/telephony/SmsManager.java
+++ b/telephony/java/android/telephony/SmsManager.java
@@ -2425,16 +2425,6 @@
/** Intent extra name for HTTP status code for MMS HTTP failure in integer type */
public static final String EXTRA_MMS_HTTP_STATUS = "android.telephony.extra.MMS_HTTP_STATUS";
- /** Represents the received SMS message for importing {@hide} */
- public static final int SMS_TYPE_INCOMING = 0;
- /** Represents the sent SMS message for importing {@hide} */
- public static final int SMS_TYPE_OUTGOING = 1;
-
- /** Message status property: whether the message has been seen. 1 means seen, 0 not {@hide} */
- public static final String MESSAGE_STATUS_SEEN = "seen";
- /** Message status property: whether the message has been read. 1 means read, 0 not {@hide} */
- public static final String MESSAGE_STATUS_READ = "read";
-
/**
* Get carrier-dependent MMS configuration values.
*
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 35b7313..690393b 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -9093,15 +9093,20 @@
}
/**
- * Requested state of SIM
- *
- * CARD_POWER_DOWN
* Powers down the SIM. SIM must be up prior.
- *
- * CARD_POWER_UP
+ * @hide
+ */
+ @SystemApi
+ public static final int CARD_POWER_DOWN = 0;
+
+ /**
* Powers up the SIM normally. SIM must be down prior.
- *
- * CARD_POWER_UP_PASS_THROUGH
+ * @hide
+ */
+ @SystemApi
+ public static final int CARD_POWER_UP = 1;
+
+ /**
* Powers up the SIM in PASS_THROUGH mode. SIM must be down prior.
* When SIM is powered up in PASS_THOUGH mode, the modem does not send
* any command to it (for example SELECT of MF, or TERMINAL CAPABILITY),
@@ -9114,12 +9119,9 @@
* is activated, and normal behavior occurs at the next SIM initialization,
* unless PASS_THROUGH mode is requested again. Hence, the last power-up mode
* is NOT persistent across boots. On reboot, SIM will power up normally.
+ * @hide
*/
- /** @hide */
- public static final int CARD_POWER_DOWN = 0;
- /** @hide */
- public static final int CARD_POWER_UP = 1;
- /** @hide */
+ @SystemApi
public static final int CARD_POWER_UP_PASS_THROUGH = 2;
/**
diff --git a/telephony/java/android/telephony/ims/feature/ImsFeature.java b/telephony/java/android/telephony/ims/feature/ImsFeature.java
index 72390d0..f14270f 100644
--- a/telephony/java/android/telephony/ims/feature/ImsFeature.java
+++ b/telephony/java/android/telephony/ims/feature/ImsFeature.java
@@ -337,11 +337,10 @@
}
/**
- * @return The current state of the feature, defined as {@link #STATE_UNAVAILABLE},
- * {@link #STATE_INITIALIZING}, or {@link #STATE_READY}.
- * @hide
+ * @return The current state of the ImsFeature, set previously by {@link #setFeatureState(int)}
+ * or {@link #STATE_UNAVAILABLE} if it has not been updated yet.
*/
- public int getFeatureState() {
+ public @ImsState int getFeatureState() {
synchronized (mLock) {
return mState;
}
diff --git a/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java b/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java
index feac3c2..3ec4f34 100644
--- a/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java
@@ -16,6 +16,7 @@
package android.telephony.ims.stub;
+import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.os.Bundle;
@@ -25,6 +26,9 @@
import com.android.ims.internal.IImsUt;
import com.android.ims.internal.IImsUtListener;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
/**
* Base implementation of IMS UT interface, which implements stubs. Override these methods to
* implement functionality.
@@ -36,6 +40,70 @@
@SystemApi
@TestApi
public class ImsUtImplBase {
+ /**
+ * Bar all incoming calls. (See 3GPP TS 24.611)
+ */
+ public static final int CALL_BARRING_ALL_INCOMING = 1;
+
+ /**
+ * Bar all outgoing calls. (See 3GPP TS 24.611)
+ */
+ public static final int CALL_BARRING_ALL_OUTGOING = 2;
+
+ /**
+ * Bar all outgoing international calls. (See 3GPP TS 24.611)
+ */
+ public static final int CALL_BARRING_OUTGOING_INTL = 3;
+
+ /**
+ * Bar all outgoing international calls, excluding those to the home PLMN country
+ * (See 3GPP TS 24.611)
+ */
+ public static final int CALL_BARRING_OUTGOING_INTL_EXCL_HOME = 4;
+
+ /**
+ * Bar all incoming calls when roaming (See 3GPP TS 24.611)
+ */
+ public static final int CALL_BLOCKING_INCOMING_WHEN_ROAMING = 5;
+
+ /**
+ * Enable Anonymous Communication Rejection (See 3GPP TS 24.611)
+ */
+ public static final int CALL_BARRING_ANONYMOUS_INCOMING = 6;
+
+ /**
+ * Bar all incoming and outgoing calls. (See 3GPP TS 24.611)
+ */
+ public static final int CALL_BARRING_ALL = 7;
+
+ /**
+ * Bar all outgoing service requests, including calls. (See 3GPP TS 24.611)
+ */
+ public static final int CALL_BARRING_OUTGOING_ALL_SERVICES = 8;
+
+ /**
+ * Bar all incoming service requests, including calls. (See 3GPP TS 24.611)
+ */
+ public static final int CALL_BARRING_INCOMING_ALL_SERVICES = 9;
+
+ /**
+ * Bar specific incoming calls. (See 3GPP TS 24.611)
+ */
+ public static final int CALL_BARRING_SPECIFIC_INCOMING_CALLS = 10;
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = "CALL_BARRING_", value = {CALL_BARRING_ALL_INCOMING, CALL_BARRING_ALL_OUTGOING,
+ CALL_BARRING_OUTGOING_INTL, CALL_BARRING_OUTGOING_INTL_EXCL_HOME,
+ CALL_BLOCKING_INCOMING_WHEN_ROAMING, CALL_BARRING_ANONYMOUS_INCOMING,
+ CALL_BARRING_ALL, CALL_BARRING_OUTGOING_ALL_SERVICES,
+ CALL_BARRING_INCOMING_ALL_SERVICES, CALL_BARRING_SPECIFIC_INCOMING_CALLS})
+ public @interface CallBarringMode {}
+
+ /**
+ * Constant used to denote an invalid return value.
+ */
+ public static final int INVALID_RESULT = -1;
private IImsUt.Stub mServiceImpl = new IImsUt.Stub() {
@Override
@@ -247,15 +315,15 @@
/**
* Updates the configuration of the call barring.
*/
- public int updateCallBarring(int cbType, int action, String[] barrList) {
+ public int updateCallBarring(@CallBarringMode int cbType, int action, String[] barrList) {
return -1;
}
/**
* Updates the configuration of the call barring for specified service class.
*/
- public int updateCallBarringForServiceClass(int cbType, int action, String[] barrList,
- int serviceClass) {
+ public int updateCallBarringForServiceClass(@CallBarringMode int cbType, int action,
+ String[] barrList, int serviceClass) {
return -1;
}
diff --git a/telephony/java/com/android/ims/ImsUtInterface.java b/telephony/java/com/android/ims/ImsUtInterface.java
index 50b63bd..15f8371 100644
--- a/telephony/java/com/android/ims/ImsUtInterface.java
+++ b/telephony/java/com/android/ims/ImsUtInterface.java
@@ -21,6 +21,7 @@
import android.os.Message;
import android.telephony.ims.ImsCallForwardInfo;
import android.telephony.ims.ImsSsInfo;
+import android.telephony.ims.stub.ImsUtImplBase;
/**
* Provides APIs for the supplementary service settings using IMS (Ut interface).
@@ -58,47 +59,48 @@
* CDIV (Communication Diversion, 3GPP TS 24.604)
* actions: target, no reply timer
*/
- public static final int CDIV_CF_UNCONDITIONAL = 0;
- public static final int CDIV_CF_BUSY = 1;
- public static final int CDIV_CF_NO_REPLY = 2;
- public static final int CDIV_CF_NOT_REACHABLE = 3;
+ public static final int CDIV_CF_UNCONDITIONAL = ImsCallForwardInfo.CDIV_CF_REASON_UNCONDITIONAL;
+ public static final int CDIV_CF_BUSY = ImsCallForwardInfo.CDIV_CF_REASON_BUSY;
+ public static final int CDIV_CF_NO_REPLY = ImsCallForwardInfo.CDIV_CF_REASON_NO_REPLY;
+ public static final int CDIV_CF_NOT_REACHABLE = ImsCallForwardInfo.CDIV_CF_REASON_NOT_REACHABLE;
// For CS service code: 002
- public static final int CDIV_CF_ALL = 4;
+ public static final int CDIV_CF_ALL = ImsCallForwardInfo.CDIV_CF_REASON_ALL;
// For CS service code: 004
- public static final int CDIV_CF_ALL_CONDITIONAL = 5;
+ public static final int CDIV_CF_ALL_CONDITIONAL =
+ ImsCallForwardInfo.CDIV_CF_REASON_ALL_CONDITIONAL;
// It's only supported in the IMS service (CS does not define it).
// IR.92 recommends that an UE activates both the CFNRc and the CFNL
// (CDIV using condition not-registered) to the same target.
- public static final int CDIV_CF_NOT_LOGGED_IN = 6;
+ public static final int CDIV_CF_NOT_LOGGED_IN = ImsCallForwardInfo.CDIV_CF_REASON_NOT_LOGGED_IN;
/**
* CB (Communication Barring, 3GPP TS 24.611)
*/
// Barring of All Incoming Calls
- public static final int CB_BAIC = 1;
+ public static final int CB_BAIC = ImsUtImplBase.CALL_BARRING_ALL_INCOMING;
// Barring of All Outgoing Calls
- public static final int CB_BAOC = 2;
+ public static final int CB_BAOC = ImsUtImplBase.CALL_BARRING_ALL_OUTGOING;
// Barring of Outgoing International Calls
- public static final int CB_BOIC = 3;
+ public static final int CB_BOIC = ImsUtImplBase.CALL_BARRING_OUTGOING_INTL;
// Barring of Outgoing International Calls - excluding Home Country
- public static final int CB_BOIC_EXHC = 4;
+ public static final int CB_BOIC_EXHC = ImsUtImplBase.CALL_BARRING_OUTGOING_INTL_EXCL_HOME;
// Barring of Incoming Calls - when roaming
- public static final int CB_BIC_WR = 5;
+ public static final int CB_BIC_WR = ImsUtImplBase.CALL_BLOCKING_INCOMING_WHEN_ROAMING;
// Barring of Anonymous Communication Rejection (ACR) - a particular case of ICB service
- public static final int CB_BIC_ACR = 6;
+ public static final int CB_BIC_ACR = ImsUtImplBase.CALL_BARRING_ANONYMOUS_INCOMING;
// Barring of All Calls
- public static final int CB_BA_ALL = 7;
+ public static final int CB_BA_ALL = ImsUtImplBase.CALL_BARRING_ALL;
// Barring of Outgoing Services (Service Code 333 - 3GPP TS 22.030 Table B-1)
- public static final int CB_BA_MO = 8;
+ public static final int CB_BA_MO = ImsUtImplBase.CALL_BARRING_OUTGOING_ALL_SERVICES;
// Barring of Incoming Services (Service Code 353 - 3GPP TS 22.030 Table B-1)
- public static final int CB_BA_MT = 9;
+ public static final int CB_BA_MT = ImsUtImplBase.CALL_BARRING_INCOMING_ALL_SERVICES;
// Barring of Specific Incoming calls
- public static final int CB_BS_MT = 10;
+ public static final int CB_BS_MT = ImsUtImplBase.CALL_BARRING_SPECIFIC_INCOMING_CALLS;
/**
* Invalid result value.
*/
- public static final int INVALID = (-1);
+ public static final int INVALID = ImsUtImplBase.INVALID_RESULT;
diff --git a/tests/libs-permissions/Android.bp b/tests/libs-permissions/Android.bp
index 330bfc9..66a1f83 100644
--- a/tests/libs-permissions/Android.bp
+++ b/tests/libs-permissions/Android.bp
@@ -2,6 +2,7 @@
name: "com.android.test.libs.product",
installable: true,
product_specific: true,
+ sdk_version: "current",
srcs: ["product/java/**/*.java"],
required: ["com.android.test.libs.product.xml"],
}