Merge changes If9068025,I728e5bf9,I9d41169d
* changes:
InputManagerService: Add Mic Mute switch support
AudioService: Add reporting of Mic Mute on start
InputManager: Add isMicMuted() helper
diff --git a/Android.bp b/Android.bp
index 7577353..05675df 100644
--- a/Android.bp
+++ b/Android.bp
@@ -112,6 +112,14 @@
}
filegroup {
+ name: "framework-mime-sources",
+ srcs: [
+ "mime/java/**/*.java",
+ ],
+ path: "mime/java",
+}
+
+filegroup {
name: "framework-opengl-sources",
srcs: [
"opengl/java/**/*.java",
@@ -176,6 +184,7 @@
":framework-mca-effect-sources",
":framework-mca-filterfw-sources",
":framework-mca-filterpacks-sources",
+ ":framework-mime-sources",
":framework-opengl-sources",
":framework-rs-sources",
":framework-sax-sources",
@@ -310,7 +319,10 @@
jarjar_rules: ":framework-jarjar-rules",
- static_libs: ["framework-internal-utils"],
+ static_libs: [
+ "framework-internal-utils",
+ "mimemap",
+ ],
required: [
// TODO: remove gps_debug when the build system propagates "required" properly.
diff --git a/api/current.txt b/api/current.txt
index 1cfc86a..436ebdc 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -43047,6 +43047,7 @@
field public static final String EXTRA_SILENT_RINGING_REQUESTED = "android.telecom.extra.SILENT_RINGING_REQUESTED";
field public static final String EXTRA_SUGGESTED_PHONE_ACCOUNTS = "android.telecom.extra.SUGGESTED_PHONE_ACCOUNTS";
field public static final int STATE_ACTIVE = 4; // 0x4
+ field public static final int STATE_AUDIO_PROCESSING = 12; // 0xc
field public static final int STATE_CONNECTING = 9; // 0x9
field public static final int STATE_DIALING = 1; // 0x1
field public static final int STATE_DISCONNECTED = 7; // 0x7
@@ -43056,6 +43057,7 @@
field public static final int STATE_PULLING_CALL = 11; // 0xb
field public static final int STATE_RINGING = 2; // 0x2
field public static final int STATE_SELECT_PHONE_ACCOUNT = 8; // 0x8
+ field public static final int STATE_SIMULATED_RINGING = 13; // 0xd
}
public abstract static class Call.Callback {
@@ -44167,6 +44169,7 @@
field public static final String KEY_USE_HFA_FOR_PROVISIONING_BOOL = "use_hfa_for_provisioning_bool";
field public static final String KEY_USE_OTASP_FOR_PROVISIONING_BOOL = "use_otasp_for_provisioning_bool";
field public static final String KEY_USE_RCS_PRESENCE_BOOL = "use_rcs_presence_bool";
+ field public static final String KEY_USE_RCS_SIP_OPTIONS_BOOL = "use_rcs_sip_options_bool";
field public static final String KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL = "voicemail_notification_persistent_bool";
field public static final String KEY_VOICE_PRIVACY_DISABLE_UI_BOOL = "voice_privacy_disable_ui_bool";
field public static final String KEY_VOLTE_REPLACEMENT_RAT_INT = "volte_replacement_rat_int";
diff --git a/api/system-current.txt b/api/system-current.txt
index 8132c76..954ed51 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6893,6 +6893,8 @@
public final class Call {
method @Deprecated public void addListener(android.telecom.Call.Listener);
+ method public void enterBackgroundAudioProcessing();
+ method public void exitBackgroundAudioProcessing(boolean);
method @Deprecated public void removeListener(android.telecom.Call.Listener);
field @Deprecated public static final int STATE_PRE_DIAL_WAIT = 8; // 0x8
}
@@ -6901,6 +6903,10 @@
ctor @Deprecated public Call.Listener();
}
+ public static class CallScreeningService.CallResponse.Builder {
+ method public android.telecom.CallScreeningService.CallResponse.Builder setShouldScreenCallFurther(boolean);
+ }
+
public abstract class Conference extends android.telecom.Conferenceable {
method @Deprecated public final android.telecom.AudioState getAudioState();
method @Deprecated public final long getConnectTimeMillis();
@@ -7752,6 +7758,8 @@
method public void onCallAttributesChanged(@NonNull android.telephony.CallAttributes);
method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onCallDisconnectCauseChanged(int, int);
method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onImsCallDisconnectCauseChanged(@NonNull android.telephony.ims.ImsReasonInfo);
+ method public void onOutgoingEmergencyCall(@NonNull android.telephony.emergency.EmergencyNumber);
+ method public void onOutgoingEmergencySms(@NonNull android.telephony.emergency.EmergencyNumber);
method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onPreciseCallStateChanged(@NonNull android.telephony.PreciseCallState);
method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState);
method public void onRadioPowerStateChanged(int);
@@ -8273,6 +8281,27 @@
}
+package android.telephony.cdma {
+
+ public final class CdmaSmsCbProgramData implements android.os.Parcelable {
+ method public int describeContents();
+ method public int getCategory();
+ method public int getOperation();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final int CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY = 4099; // 0x1003
+ field public static final int CATEGORY_CMAS_EXTREME_THREAT = 4097; // 0x1001
+ field public static final int CATEGORY_CMAS_LAST_RESERVED_VALUE = 4351; // 0x10ff
+ field public static final int CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT = 4096; // 0x1000
+ field public static final int CATEGORY_CMAS_SEVERE_THREAT = 4098; // 0x1002
+ field public static final int CATEGORY_CMAS_TEST_MESSAGE = 4100; // 0x1004
+ field @NonNull public static final android.os.Parcelable.Creator<android.telephony.cdma.CdmaSmsCbProgramData> CREATOR;
+ field public static final int OPERATION_ADD_CATEGORY = 1; // 0x1
+ field public static final int OPERATION_CLEAR_CATEGORIES = 2; // 0x2
+ field public static final int OPERATION_DELETE_CATEGORY = 0; // 0x0
+ }
+
+}
+
package android.telephony.data {
public final class DataCallResponse implements android.os.Parcelable {
diff --git a/api/test-current.txt b/api/test-current.txt
index 077abe0..dab0e7b1 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -2733,10 +2733,19 @@
package android.telecom {
+ public final class Call {
+ method public void enterBackgroundAudioProcessing();
+ method public void exitBackgroundAudioProcessing(boolean);
+ }
+
public final class CallAudioState implements android.os.Parcelable {
ctor public CallAudioState(boolean, int, int, @Nullable android.bluetooth.BluetoothDevice, @NonNull java.util.Collection<android.bluetooth.BluetoothDevice>);
}
+ public static class CallScreeningService.CallResponse.Builder {
+ method public android.telecom.CallScreeningService.CallResponse.Builder setShouldScreenCallFurther(boolean);
+ }
+
public abstract class Conference extends android.telecom.Conferenceable {
method public android.telecom.Connection getPrimaryConnection();
}
@@ -2852,6 +2861,11 @@
method public static void setMinMatchForTest(int);
}
+ public class PhoneStateListener {
+ field @RequiresPermission("android.permission.READ_ACTIVE_EMERGENCY_SESSION") public static final int LISTEN_OUTGOING_CALL_EMERGENCY_NUMBER = 268435456; // 0x10000000
+ field @RequiresPermission("android.permission.READ_ACTIVE_EMERGENCY_SESSION") public static final int LISTEN_OUTGOING_SMS_EMERGENCY_NUMBER = 536870912; // 0x20000000
+ }
+
public class ServiceState implements android.os.Parcelable {
method public void addNetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo);
method public void setCdmaSystemAndNetworkId(int, int);
@@ -2889,6 +2903,14 @@
}
+package android.telephony.emergency {
+
+ public final class EmergencyNumber implements java.lang.Comparable<android.telephony.emergency.EmergencyNumber> android.os.Parcelable {
+ field public static final int EMERGENCY_NUMBER_SOURCE_TEST = 32; // 0x20
+ }
+
+}
+
package android.telephony.mbms {
public static class DownloadRequest.Builder {
diff --git a/cmds/idmap2/idmap2/Scan.cpp b/cmds/idmap2/idmap2/Scan.cpp
index 0b349e1..da8c06e 100644
--- a/cmds/idmap2/idmap2/Scan.cpp
+++ b/cmds/idmap2/idmap2/Scan.cpp
@@ -176,6 +176,17 @@
continue;
}
+ // Note that conditional property enablement/exclusion only applies if
+ // the attribute is present. In its absence, all overlays are presumed enabled.
+ if (!overlay_info->requiredSystemPropertyName.empty()
+ && !overlay_info->requiredSystemPropertyValue.empty()) {
+ // if property set & equal to value, then include overlay - otherwise skip
+ if (android::base::GetProperty(overlay_info->requiredSystemPropertyName, "")
+ != overlay_info->requiredSystemPropertyValue) {
+ continue;
+ }
+ }
+
std::vector<std::string> fulfilled_policies;
if (!override_policies.empty()) {
fulfilled_policies = override_policies;
diff --git a/cmds/idmap2/include/idmap2/ResourceUtils.h b/cmds/idmap2/include/idmap2/ResourceUtils.h
index 8797a78..9a0c2ab 100644
--- a/cmds/idmap2/include/idmap2/ResourceUtils.h
+++ b/cmds/idmap2/include/idmap2/ResourceUtils.h
@@ -30,6 +30,8 @@
struct OverlayManifestInfo {
std::string target_package; // NOLINT(misc-non-private-member-variables-in-classes)
std::string target_name; // NOLINT(misc-non-private-member-variables-in-classes)
+ std::string requiredSystemPropertyName; // NOLINT(misc-non-private-member-variables-in-classes)
+ std::string requiredSystemPropertyValue; // NOLINT(misc-non-private-member-variables-in-classes)
bool is_static; // NOLINT(misc-non-private-member-variables-in-classes)
int priority = -1; // NOLINT(misc-non-private-member-variables-in-classes)
};
diff --git a/cmds/idmap2/libidmap2/ResourceUtils.cpp b/cmds/idmap2/libidmap2/ResourceUtils.cpp
index 71ba3f0..dce83e3 100644
--- a/cmds/idmap2/libidmap2/ResourceUtils.cpp
+++ b/cmds/idmap2/libidmap2/ResourceUtils.cpp
@@ -103,6 +103,16 @@
info.priority = std::stoi(iter->second);
}
+ iter = tag->find("requiredSystemPropertyName");
+ if (iter != tag->end()) {
+ info.requiredSystemPropertyName = iter->second;
+ }
+
+ iter = tag->find("requiredSystemPropertyValue");
+ if (iter != tag->end()) {
+ info.requiredSystemPropertyValue = iter->second;
+ }
+
return info;
}
diff --git a/cmds/telecom/src/com/android/commands/telecom/Telecom.java b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
index e0f7d86..c9f069d 100644
--- a/cmds/telecom/src/com/android/commands/telecom/Telecom.java
+++ b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
@@ -65,11 +65,21 @@
private static final String COMMAND_UNREGISTER_PHONE_ACCOUNT = "unregister-phone-account";
private static final String COMMAND_SET_DEFAULT_DIALER = "set-default-dialer";
private static final String COMMAND_GET_DEFAULT_DIALER = "get-default-dialer";
+ /**
+ * Change the system dialer package name if a package name was specified,
+ * Example: adb shell telecom set-system-dialer <PACKAGE>
+ *
+ * Restore it to the default if if argument is "default" or no argument is passed.
+ * Example: adb shell telecom set-system-dialer default
+ */
+ private static final String COMMAND_SET_SYSTEM_DIALER = "set-system-dialer";
private static final String COMMAND_GET_SYSTEM_DIALER = "get-system-dialer";
private static final String COMMAND_WAIT_ON_HANDLERS = "wait-on-handlers";
private static final String COMMAND_SET_SIM_COUNT = "set-sim-count";
private static final String COMMAND_GET_SIM_CONFIG = "get-sim-config";
private static final String COMMAND_GET_MAX_PHONES = "get-max-phones";
+ private static final String COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER =
+ "set-test-emergency-phone-account-package-filter";
private ComponentName mComponent;
private String mAccountId;
@@ -83,7 +93,10 @@
+ "usage: telecom set-phone-account-enabled <COMPONENT> <ID> <USER_SN>\n"
+ "usage: telecom set-phone-account-disabled <COMPONENT> <ID> <USER_SN>\n"
+ "usage: telecom register-phone-account <COMPONENT> <ID> <USER_SN> <LABEL>\n"
- + "usage: telecom set-user-selected-outgoing-phone-account <COMPONENT> <ID> "
+ + "usage: telecom register-sim-phone-account [-e] <COMPONENT> <ID> <USER_SN>"
+ + " <LABEL>: registers a PhoneAccount with CAPABILITY_SIM_SUBSCRIPTION"
+ + " and optionally CAPABILITY_PLACE_EMERGENCY_CALLS if \"-e\" is provided\n"
+ + "usage: telecom set-user-selected-outgoing-phone-account [-e] <COMPONENT> <ID> "
+ "<USER_SN>\n"
+ "usage: telecom set-test-call-redirection-app <PACKAGE>\n"
+ "usage: telecom set-test-call-screening-app <PACKAGE>\n"
@@ -100,6 +113,7 @@
+ "usage: telecom set-sim-count <COUNT>\n"
+ "usage: telecom get-sim-config\n"
+ "usage: telecom get-max-phones\n"
+ + "usage: telecom set-emer-phone-account-filter <PACKAGE>\n"
+ "\n"
+ "telecom set-phone-account-enabled: Enables the given phone account, if it has"
+ " already been registered with Telecom.\n"
@@ -113,6 +127,8 @@
+ "telecom get-default-dialer: Displays the current default dialer.\n"
+ "\n"
+ "telecom get-system-dialer: Displays the current system dialer.\n"
+ + "telecom set-system-dialer: Set the override system dialer to the given"
+ + " component. To remove the override, send \"default\"\n"
+ "\n"
+ "telecom wait-on-handlers: Wait until all handlers finish their work.\n"
+ "\n"
@@ -123,6 +139,10 @@
+ " or \"\" for single SIM\n"
+ "\n"
+ "telecom get-max-phones: Get the max supported phones from the modem.\n"
+ + "telecom set-test-emergency-phone-account-package-filter <PACKAGE>: sets a"
+ + " package name that will be used for test emergency calls. To clear,"
+ + " send an empty package name. Real emergency calls will still be placed"
+ + " over Telephony.\n"
);
}
@@ -193,6 +213,9 @@
case COMMAND_GET_DEFAULT_DIALER:
runGetDefaultDialer();
break;
+ case COMMAND_SET_SYSTEM_DIALER:
+ runSetSystemDialer();
+ break;
case COMMAND_GET_SYSTEM_DIALER:
runGetSystemDialer();
break;
@@ -208,6 +231,9 @@
case COMMAND_GET_MAX_PHONES:
runGetMaxPhones();
break;
+ case COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER:
+ runSetEmergencyPhoneAccountPackageFilter();
+ break;
default:
Log.w(this, "onRun: unknown command: %s", command);
throw new IllegalArgumentException ("unknown command '" + command + "'");
@@ -234,19 +260,31 @@
}
private void runRegisterSimPhoneAccount() throws RemoteException {
+ boolean isEmergencyAccount = false;
+ String opt;
+ while ((opt = nextOption()) != null) {
+ switch (opt) {
+ case "-e": {
+ isEmergencyAccount = true;
+ break;
+ }
+ }
+ }
final PhoneAccountHandle handle = getPhoneAccountHandleFromArgs();
final String label = nextArgRequired();
final String address = nextArgRequired();
+ int capabilities = PhoneAccount.CAPABILITY_CALL_PROVIDER
+ | PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION
+ | (isEmergencyAccount ? PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS : 0);
PhoneAccount account = PhoneAccount.builder(
handle, label)
- .setAddress(Uri.parse(address))
- .setSubscriptionAddress(Uri.parse(address))
- .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER |
- PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)
- .setShortDescription(label)
- .addSupportedUriScheme(PhoneAccount.SCHEME_TEL)
- .addSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL)
- .build();
+ .setAddress(Uri.parse(address))
+ .setSubscriptionAddress(Uri.parse(address))
+ .setCapabilities(capabilities)
+ .setShortDescription(label)
+ .addSupportedUriScheme(PhoneAccount.SCHEME_TEL)
+ .addSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL)
+ .build();
mTelecomService.registerPhoneAccount(account);
System.out.println("Success - " + handle + " registered.");
}
@@ -297,6 +335,14 @@
System.out.println("Success - " + packageName + " set as override default dialer.");
}
+ private void runSetSystemDialer() throws RemoteException {
+ final String flatComponentName = nextArg();
+ final ComponentName componentName = (flatComponentName.equals("default")
+ ? null : parseComponentName(flatComponentName));
+ mTelecomService.setSystemDialer(componentName);
+ System.out.println("Success - " + componentName + " set as override system dialer.");
+ }
+
private void runGetDefaultDialer() throws RemoteException {
System.out.println(mTelecomService.getDefaultDialerPackage());
}
@@ -338,6 +384,18 @@
}
}
+ private void runSetEmergencyPhoneAccountPackageFilter() throws RemoteException {
+ String packageName = mArgs.getNextArg();
+ if (TextUtils.isEmpty(packageName)) {
+ mTelecomService.setTestEmergencyPhoneAccountPackageNameFilter(null);
+ System.out.println("Success - filter cleared");
+ } else {
+ mTelecomService.setTestEmergencyPhoneAccountPackageNameFilter(packageName);
+ System.out.println("Success = filter set to " + packageName);
+ }
+
+ }
+
private PhoneAccountHandle getPhoneAccountHandleFromArgs() throws RemoteException {
if (TextUtils.isEmpty(mArgs.peekNextArg())) {
return null;
diff --git a/core/java/android/os/image/DynamicSystemManager.java b/core/java/android/os/image/DynamicSystemManager.java
index cec1945..77fd946 100644
--- a/core/java/android/os/image/DynamicSystemManager.java
+++ b/core/java/android/os/image/DynamicSystemManager.java
@@ -20,6 +20,7 @@
import android.annotation.SystemService;
import android.content.Context;
import android.gsi.GsiProgress;
+import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
/**
@@ -52,22 +53,39 @@
/** The DynamicSystemManager.Session represents a started session for the installation. */
public class Session {
private Session() {}
+
/**
- * Write a chunk of the DynamicSystem system image
+ * Set the file descriptor that points to a ashmem which will be used
+ * to fetch data during the submitFromAshmem.
*
- * @return {@code true} if the call succeeds. {@code false} if there is any native runtime
- * error.
+ * @param ashmem fd that points to a ashmem
+ * @param size size of the ashmem file
*/
@RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
- public boolean write(byte[] buf) {
+ public boolean setAshmem(ParcelFileDescriptor ashmem, long size) {
try {
- return mService.write(buf);
+ return mService.setAshmem(ashmem, size);
} catch (RemoteException e) {
throw new RuntimeException(e.toString());
}
}
/**
+ * Submit bytes to the DSU partition from the ashmem previously set with
+ * setAshmem.
+ *
+ * @param size Number of bytes
+ * @return true on success, false otherwise.
+ */
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
+ public boolean submitFromAshmem(int size) {
+ try {
+ return mService.submitFromAshmem(size);
+ } catch (RemoteException e) {
+ throw new RuntimeException(e.toString());
+ }
+ }
+ /**
* Finish write and make device to boot into the it after reboot.
*
* @return {@code true} if the call succeeds. {@code false} if there is any native runtime
@@ -76,7 +94,7 @@
@RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
public boolean commit() {
try {
- return mService.commit();
+ return mService.setEnable(true, true);
} catch (RemoteException e) {
throw new RuntimeException(e.toString());
}
@@ -188,9 +206,9 @@
* @return {@code true} if the call succeeds. {@code false} if there is no installed image.
*/
@RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
- public boolean setEnable(boolean enable) {
+ public boolean setEnable(boolean enable, boolean oneShot) {
try {
- return mService.setEnable(enable);
+ return mService.setEnable(enable, oneShot);
} 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 a34daca..a6de170 100644
--- a/core/java/android/os/image/IDynamicSystemService.aidl
+++ b/core/java/android/os/image/IDynamicSystemService.aidl
@@ -72,21 +72,27 @@
/**
* Enable or disable DynamicSystem.
*
- * @return true if the call succeeds
- */
- boolean setEnable(boolean enable);
-
- /**
- * Write a chunk of the DynamicSystem system image
+ * @param oneShot If true, the GSI will boot once and then disable itself.
*
* @return true if the call succeeds
*/
- boolean write(in byte[] buf);
+ boolean setEnable(boolean enable, boolean oneShot);
/**
- * Finish write and make device to boot into the it after reboot.
+ * Set the file descriptor that points to a ashmem which will be used
+ * to fetch data during the submitFromAshmem.
*
- * @return true if the call succeeds
+ * @param fd fd that points to a ashmem
+ * @param size size of the ashmem file
*/
- boolean commit();
+ boolean setAshmem(in ParcelFileDescriptor fd, long size);
+
+ /**
+ * Submit bytes to the DSU partition from the ashmem previously set with
+ * setAshmem.
+ *
+ * @param bytes number of bytes that can be read from stream.
+ * @return true on success, false otherwise.
+ */
+ boolean submitFromAshmem(long bytes);
}
diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java
index d6caa09..9fff447 100644
--- a/core/java/com/android/internal/os/RuntimeInit.java
+++ b/core/java/com/android/internal/os/RuntimeInit.java
@@ -20,6 +20,7 @@
import android.app.ActivityManager;
import android.app.ActivityThread;
import android.app.ApplicationErrorReport;
+import android.content.type.DefaultMimeMapFactory;
import android.os.Build;
import android.os.DeadObjectException;
import android.os.Debug;
@@ -33,6 +34,9 @@
import com.android.server.NetworkManagementSocketTagger;
import dalvik.system.RuntimeHooks;
import dalvik.system.VMRuntime;
+
+import libcore.net.MimeMap;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -199,6 +203,13 @@
public static void preForkInit() {
if (DEBUG) Slog.d(TAG, "Entered preForkInit.");
RuntimeInit.enableDdms();
+ /*
+ * Replace libcore's minimal default mapping between MIME types and file
+ * extensions with a mapping that's suitable for Android. Android's mapping
+ * contains many more entries that are derived from IANA registrations but
+ * with several customizations (extensions, overrides).
+ */
+ MimeMap.setDefault(DefaultMimeMapFactory.create());
}
@UnsupportedAppUsage
diff --git a/core/proto/android/telecomm/enums.proto b/core/proto/android/telecomm/enums.proto
index 7a2ba62..5ca4a85 100644
--- a/core/proto/android/telecomm/enums.proto
+++ b/core/proto/android/telecomm/enums.proto
@@ -110,6 +110,24 @@
* {@link android.telecom.Connection#CAPABILITY_CAN_PULL_CALL}.
*/
PULLING = 10;
+
+ /**
+ * Indicates that an incoming call has been answered by the in-call UI, but Telephony hasn't yet
+ * set the call to active.
+ */
+ ANSWERED = 11;
+
+ /**
+ * Indicates that the call is undergoing audio processing by a different app in the background.
+ * @see android.telecom.Call#STATE_AUDIO_PROCESSING
+ */
+ AUDIO_PROCESSING = 12;
+
+ /**
+ * Indicates that the call is in a fake ringing state.
+ * @see android.telecom.Call#STATE_SIMULATED_RINGING
+ */
+ SIMULATED_RINGING = 13;
}
// Disconnect causes for a call. Primarily used by android/telecom/DisconnectCause.java
diff --git a/data/fonts/fonts.xml b/data/fonts/fonts.xml
index 072beae..c692097 100644
--- a/data/fonts/fonts.xml
+++ b/data/fonts/fonts.xml
@@ -323,14 +323,16 @@
<font weight="700" style="normal">NotoSansLaoUI-Bold.ttf</font>
</family>
<family lang="und-Mymr" variant="elegant">
- <font weight="400" style="normal">NotoSansMyanmar-Regular-ZawDecode.ttf</font>
- <font weight="700" style="normal">NotoSansMyanmar-Bold-ZawDecode.ttf</font>
+ <font weight="400" style="normal">NotoSansMyanmar-Regular.otf</font>
+ <font weight="500" style="normal">NotoSansMyanmar-Medium.otf</font>
+ <font weight="700" style="normal">NotoSansMyanmar-Bold.otf</font>
<font weight="400" style="normal" fallbackFor="serif">NotoSerifMyanmar-Regular.otf</font>
<font weight="700" style="normal" fallbackFor="serif">NotoSerifMyanmar-Bold.otf</font>
</family>
<family lang="und-Mymr" variant="compact">
- <font weight="400" style="normal">NotoSansMyanmarUI-Regular-ZawDecode.ttf</font>
- <font weight="700" style="normal">NotoSansMyanmarUI-Bold-ZawDecode.ttf</font>
+ <font weight="400" style="normal">NotoSansMyanmarUI-Regular.otf</font>
+ <font weight="500" style="normal">NotoSansMyanmarUI-Medium.otf</font>
+ <font weight="700" style="normal">NotoSansMyanmarUI-Bold.otf</font>
</family>
<family lang="und-Thaa">
<font weight="400" style="normal">NotoSansThaana-Regular.ttf</font>
diff --git a/libs/hwui/pipeline/skia/LayerDrawable.cpp b/libs/hwui/pipeline/skia/LayerDrawable.cpp
index b017384..f839213e 100644
--- a/libs/hwui/pipeline/skia/LayerDrawable.cpp
+++ b/libs/hwui/pipeline/skia/LayerDrawable.cpp
@@ -43,41 +43,28 @@
if (!matrix.rectStaysRect()) return true;
SkRect dstDevRect = matrix.mapRect(dstRect);
float dstW, dstH;
- bool requiresIntegerTranslate = false;
if (MathUtils::isZero(matrix.getScaleX()) && MathUtils::isZero(matrix.getScaleY())) {
// Has a 90 or 270 degree rotation, although total matrix may also have scale factors
// in m10 and m01. Those scalings are automatically handled by mapRect so comparing
// dimensions is sufficient, but swap width and height comparison.
dstW = dstDevRect.height();
dstH = dstDevRect.width();
- requiresIntegerTranslate = true;
} else {
// Handle H/V flips or 180 rotation matrices. Axes may have been mirrored, but
// dimensions are still safe to compare directly.
dstW = dstDevRect.width();
dstH = dstDevRect.height();
- requiresIntegerTranslate =
- matrix.getScaleX() < -NON_ZERO_EPSILON || matrix.getScaleY() < -NON_ZERO_EPSILON;
}
if (!(MathUtils::areEqual(dstW, srcRect.width()) &&
MathUtils::areEqual(dstH, srcRect.height()))) {
return true;
}
- if (requiresIntegerTranslate) {
- // Device rect and source rect should be integer aligned to ensure there's no difference
- // in how nearest-neighbor sampling is resolved.
- return !(isIntegerAligned(srcRect.x()) &&
- isIntegerAligned(srcRect.y()) &&
- isIntegerAligned(dstDevRect.x()) &&
- isIntegerAligned(dstDevRect.y()));
- } else {
- // As long as src and device rects are translated by the same fractional amount,
- // filtering won't be needed
- return !(MathUtils::areEqual(SkScalarFraction(srcRect.x()),
- SkScalarFraction(dstDevRect.x())) &&
- MathUtils::areEqual(SkScalarFraction(srcRect.y()),
- SkScalarFraction(dstDevRect.y())));
- }
+ // Device rect and source rect should be integer aligned to ensure there's no difference
+ // in how nearest-neighbor sampling is resolved.
+ return !(isIntegerAligned(srcRect.x()) &&
+ isIntegerAligned(srcRect.y()) &&
+ isIntegerAligned(dstDevRect.x()) &&
+ isIntegerAligned(dstDevRect.y()));
}
bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer,
diff --git a/mime/Android.bp b/mime/Android.bp
new file mode 100644
index 0000000..51290f6
--- /dev/null
+++ b/mime/Android.bp
@@ -0,0 +1,115 @@
+// 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.
+
+
+java_defaults {
+ name: "mimemap-defaults",
+ srcs: [
+ "java/android/content/type/DefaultMimeMapFactory.java",
+ ],
+ sdk_version: "core_platform",
+}
+
+java_library {
+ name: "mimemap",
+ defaults: ["mimemap-defaults"],
+ static_libs: ["mimemap-res.jar"],
+ visibility: [
+ "//frameworks/base:__subpackages__",
+ ],
+}
+
+java_library {
+ name: "mimemap-testing",
+ defaults: ["mimemap-defaults"],
+ static_libs: ["mimemap-testing-res.jar"],
+ jarjar_rules: "jarjar-rules.txt",
+ visibility: [
+ "//cts/tests/tests/mimemap:__subpackages__",
+ "//frameworks/base:__subpackages__",
+ ],
+}
+
+// The mimemap-res.jar and mimemap-testing-res.jar genrules produce a .jar that
+// has the resource file in a subdirectory res/ and testres/, respectively.
+// Those paths need to They need to be in different paths because one of them
+// ends up on a bootclasspath jar whereas the other one ends up in a test jar.
+// Bootclasspath resources hide test or application resources under the same
+// path because ClassLoader.getResource(String) consults the parent ClassLoader
+// first.
+//
+// Further notes:
+// - the "cp" command will flatten any directory paths that occur in $(in),
+// but here they happen to already be in the root directory. If we needed
+// to preserve sub paths then we might want to zip the files first and then
+// unzip them below the new parent directory.
+// - the path names "res/" and "testres/" and duplicated in .java source files
+// (DefaultMimeMapFactory.java and MimeMapTest.java, as of October 2019).
+java_genrule {
+ name: "mimemap-res.jar",
+ tools: [
+ "soong_zip",
+ ],
+ srcs: [":mime.types"],
+ out: ["mimemap-res.jar"],
+ cmd: "mkdir $(genDir)/res/ && cp $(in) $(genDir)/res/ && $(location soong_zip) -C $(genDir) -o $(out) -D $(genDir)/res/",
+}
+
+// The same as mimemap-res.jar except that the resources are placed in a different directory.
+// They get bundled with CTS so that CTS can compare a device's MimeMap implementation vs.
+// the stock Android one from when CTS was built.
+java_genrule {
+ name: "mimemap-testing-res.jar",
+ tools: [
+ "soong_zip",
+ ],
+ srcs: [":mime.types"],
+ out: ["mimemap-testing-res.jar"],
+ cmd: "mkdir $(genDir)/testres/ && cp $(in) $(genDir)/testres/ && $(location soong_zip) -C $(genDir) -o $(out) -D $(genDir)/testres/",
+}
+
+// Combination of all *mime.types resources.
+filegroup {
+ name: "mime.types",
+ visibility: [
+ "//visibility:private",
+ ],
+ srcs: [
+ ":debian.mime.types",
+ ":android.mime.types",
+ ":vendor.mime.types",
+ ],
+}
+
+filegroup {
+ name: "android.mime.types",
+ visibility: [
+ "//visibility:private",
+ ],
+ path: "java-res/",
+ srcs: [
+ "java-res/android.mime.types",
+ ],
+}
+
+filegroup {
+ name: "vendor.mime.types",
+ visibility: [
+ "//visibility:private",
+ ],
+ path: "java-res/",
+ srcs: [
+ "java-res/vendor.mime.types",
+ ],
+}
diff --git a/mime/jarjar-rules.txt b/mime/jarjar-rules.txt
new file mode 100644
index 0000000..145d1db
--- /dev/null
+++ b/mime/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.content.type.DefaultMimeMapFactory android.content.type.cts.StockAndroidMimeMapFactory
\ No newline at end of file
diff --git a/mime/java-res/android.mime.types b/mime/java-res/android.mime.types
new file mode 100644
index 0000000..7a5299f
--- /dev/null
+++ b/mime/java-res/android.mime.types
@@ -0,0 +1,146 @@
+
+###############################################################################
+#
+# Android-specific MIME type <-> extension mappings
+#
+# Each line below defines a mapping from one MIME type to the first of the
+# listed extensions, and from listed extension back to the MIME type.
+# A mapping overrides any previous mapping _from_ that same MIME type or
+# extension (put() semantics), unless that MIME type / extension is prefixed with '?'
+# (putIfAbsent() semantics).
+#
+#
+###############################################################################
+#
+# EXAMPLES
+#
+# A line of the form:
+#
+# ?mime ext1 ?ext2 ext3
+#
+# affects the current mappings along the lines of the following pseudo code:
+#
+# mimeToExt.putIfAbsent("mime", "ext1");
+# extToMime.put("ext1", "mime");
+# extToMime.putIfAbsent("ext2", "mime");
+# extToMime.put("ext3", "mime");
+#
+# The line:
+#
+# ?text/plain txt
+#
+# leaves any earlier mapping for "text/plain" untouched, or maps that MIME type
+# to the file extension ".txt" if there is no earlier mapping. The line also
+# sets the mapping from file extension ".txt" to be the MIME type "text/plain",
+# regardless of whether a previous mapping existed.
+#
+###############################################################################
+
+
+# File extensions that Android wants to override to point to the given MIME type.
+#
+# After processing a line of the form:
+# ?<mimeType> <extension1> <extension2>
+# If <mimeType> was not already mapped to an extension then it will be
+# mapped to <extension1>.
+# <extension1> and <extension2> are mapped (or remapped) to <mimeType>.
+
+?application/epub+zip epub
+?application/pkix-cert cer
+?application/rss+xml rss
+?application/vnd.android.ota ota
+?application/vnd.apple.mpegurl m3u8
+?application/vnd.ms-pki.stl stl
+?application/vnd.ms-powerpoint pot
+?application/vnd.ms-wpl wpl
+?application/vnd.stardivision.impress sdp
+?application/vnd.stardivision.writer vor
+?application/vnd.youtube.yt yt
+?application/x-android-drm-fl fl
+?application/x-flac flac
+?application/x-font pcf
+?application/x-mpegurl m3u m3u8
+?application/x-pem-file pem
+?application/x-pkcs12 p12 pfx
+?application/x-webarchive webarchive
+?application/x-webarchive-xml webarchivexml
+?application/x-x509-server-cert crt
+?application/x-x509-user-cert crt
+
+?audio/3gpp 3gpp
+?audio/aac-adts aac
+?audio/imelody imy
+?audio/midi rtttl xmf
+?audio/mobile-xmf mxmf
+?audio/mp4 m4a
+?audio/mpegurl m3u
+?audio/sp-midi smf
+?audio/x-matroska mka
+?audio/x-pn-realaudio ra
+
+?image/bmp bmp
+?image/heic heic
+?image/heic-sequence heics
+?image/heif heif hif
+?image/heif-sequence heifs
+?image/ico cur
+?image/webp webp
+?image/x-adobe-dng dng
+?image/x-fuji-raf raf
+?image/x-icon ico
+?image/x-nikon-nrw nrw
+?image/x-panasonic-rw2 rw2
+?image/x-pentax-pef pef
+?image/x-samsung-srw srw
+?image/x-sony-arw arw
+
+?text/comma-separated-values csv
+?text/plain diff po
+?text/rtf rtf
+?text/text phps
+?text/xml xml
+?text/x-vcard vcf
+
+?video/3gpp2 3gpp2 3g2
+?video/3gpp 3gpp
+?video/avi avi
+?video/m4v m4v
+?video/mp2p mpeg
+?video/mp2t m2ts mts
+?video/mp2ts ts
+?video/vnd.youtube.yt yt
+?video/x-webex wrf
+
+# Optional additions that should not override any previous mapping.
+
+?application/x-wifi-config ?xml
+
+# Special cases where Android has a strong opinion about mappings, so we
+# define them very last and make them override in both directions (no "?").
+#
+# Lines here are of the form:
+# <mimeType> <extension1> <extension2> ...
+#
+# After processing each line,
+# <mimeType> is mapped to <extension1>
+# <extension1>, <extension2>, ... are all mapped to <mimeType>
+# This overrides any mappings for this <mimeType> / for these extensions
+# that may have been defined earlier.
+
+application/pgp-signature pgp
+application/x-x509-ca-cert crt
+audio/aac aac
+audio/basic snd
+audio/flac flac
+audio/midi rtx
+audio/mpeg mp3 m4a m4r
+audio/x-mpegurl m3u m3u8
+image/jpeg jpg
+image/x-ms-bmp bmp
+text/plain txt
+text/x-c++hdr hpp
+text/x-c++src cpp
+video/3gpp 3gpp
+video/mpeg mpeg
+video/quicktime mov
+video/x-matroska mkv
diff --git a/mime/java-res/vendor.mime.types b/mime/java-res/vendor.mime.types
new file mode 100644
index 0000000..afb8f9e
--- /dev/null
+++ b/mime/java-res/vendor.mime.types
@@ -0,0 +1,41 @@
+###############################################################################
+#
+# Vendor-specific MIME type <-> extension mappings
+#
+# Each line below defines a mapping from one MIME type to the first of the
+# listed extensions, and from listed extension back to the MIME type.
+#
+# This file can _add_ additional mappings that are not in the default set,
+# but it it cannot _modify_ (replace or remove) any platform default mapping
+# (defined in files mime.types and android.mime.types).
+#
+###############################################################################
+#
+# EXAMPLES
+#
+# A line of the form (without the leading '#''):
+#
+# mime ext1 ext2 ext3
+#
+# affects the current mappings along the lines of the following pseudo code:
+#
+# mimeToExt.putIfAbsent("mime", "ext1");
+# extToMime.putIfAbsent("ext1", "mime");
+# extToMime.putIfAbsent("ext2", "mime");
+# extToMime.putIfAbsent("ext3", "mime");
+#
+# Optionally, MIME types or extensions may be prefixed by a single '?', which
+# will be ignored. I.e., the following example lines all have the same semantics:
+#
+# mime ext1 ext2 ext3
+# ?mime ext1 ext2 ext3
+# mime ?ext1 ext2 ?ext3
+# ?mime ?ext1 ?ext2 ?ext3
+#
+# By default, this file contains no mappings (which means that the platform
+# default mapping is used unmodified).
+#
+###############################################################################
+#
+# Add your custom mappings below this line (with no "#" at the start of the line):
+
diff --git a/mime/java/android/content/type/DefaultMimeMapFactory.java b/mime/java/android/content/type/DefaultMimeMapFactory.java
new file mode 100644
index 0000000..13039a4
--- /dev/null
+++ b/mime/java/android/content/type/DefaultMimeMapFactory.java
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+package android.content.type;
+
+import libcore.net.MimeMap;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Function;
+import java.util.regex.Pattern;
+
+/**
+ * Creates the framework default {@link MimeMap}, a bidirectional mapping
+ * between MIME types and file extensions.
+ *
+ * This default mapping is loaded from data files that start with some mappings
+ * recognized by IANA plus some custom extensions and overrides.
+ *
+ * @hide
+ */
+public class DefaultMimeMapFactory {
+
+ private DefaultMimeMapFactory() {
+ }
+
+ /**
+ * Creates and returns a new {@link MimeMap} instance that implements.
+ * Android's default mapping between MIME types and extensions.
+ */
+ public static MimeMap create() {
+ Class c = DefaultMimeMapFactory.class;
+ // The resources are placed into the res/ path by the "mimemap-res.jar" genrule.
+ return create(resourceName -> c.getResourceAsStream("/res/" + resourceName));
+ }
+
+ private static final Pattern SPLIT_PATTERN = Pattern.compile("\\s+");
+
+ /**
+ * Creates a {@link MimeMap} instance whose resources are loaded from the
+ * InputStreams looked up in {@code resourceSupplier}.
+ *
+ * @hide
+ */
+ public static MimeMap create(Function<String, InputStream> resourceSupplier) {
+ MimeMap.Builder builder = MimeMap.builder();
+ parseTypes(builder, true, resourceSupplier, "mime.types");
+ parseTypes(builder, true, resourceSupplier, "android.mime.types");
+ parseTypes(builder, false, resourceSupplier, "vendor.mime.types");
+ return builder.build();
+ }
+
+ private static void parseTypes(MimeMap.Builder builder, boolean allowOverwrite,
+ Function<String, InputStream> resourceSupplier, String resourceName) {
+ try (InputStream inputStream = Objects.requireNonNull(resourceSupplier.apply(resourceName));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ int commentPos = line.indexOf('#');
+ if (commentPos >= 0) {
+ line = line.substring(0, commentPos);
+ }
+ line = line.trim();
+ if (line.isEmpty()) {
+ continue;
+ }
+ List<String> specs = Arrays.asList(SPLIT_PATTERN.split(line));
+ if (!allowOverwrite) {
+ // Pretend that the mimeType and each file extension listed in the line
+ // carries a "?" prefix, which means that it can add new mappings but
+ // not modify existing mappings (putIfAbsent() semantics).
+ specs = ensurePrefix("?", specs);
+ }
+ builder.put(specs.get(0), specs.subList(1, specs.size()));
+ }
+ } catch (IOException | RuntimeException e) {
+ throw new RuntimeException("Failed to parse " + resourceName, e);
+ }
+ }
+
+ private static List<String> ensurePrefix(String prefix, List<String> strings) {
+ List<String> result = new ArrayList<>(strings.size());
+ for (String s : strings) {
+ if (!s.startsWith(prefix)) {
+ s = prefix + s;
+ }
+ result.add(s);
+ }
+ return result;
+ }
+
+}
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
index e731b45..142078e 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
@@ -291,7 +291,7 @@
if (mInstallTask != null && mInstallTask.getResult() == RESULT_OK) {
enabled = mInstallTask.commit();
} else if (isDynamicSystemInstalled()) {
- enabled = mDynSystem.setEnable(true);
+ enabled = mDynSystem.setEnable(true, true);
} else {
Log.e(TAG, "Trying to reboot to AOT while there is no complete installation");
return;
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
index 077f7ec..cf286bd 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
@@ -20,6 +20,8 @@
import android.gsi.GsiProgress;
import android.net.Uri;
import android.os.AsyncTask;
+import android.os.MemoryFile;
+import android.os.ParcelFileDescriptor;
import android.os.image.DynamicSystemManager;
import android.util.Log;
import android.webkit.URLUtil;
@@ -28,11 +30,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.Arrays;
import java.util.Locale;
import java.util.zip.GZIPInputStream;
-
class InstallationAsyncTask extends AsyncTask<String, Long, Throwable> {
private static final String TAG = "InstallationAsyncTask";
@@ -125,28 +125,26 @@
Thread.sleep(10);
}
-
if (mInstallationSession == null) {
- throw new IOException("Failed to start installation with requested size: "
- + (mSystemSize + mUserdataSize));
+ throw new IOException(
+ "Failed to start installation with requested size: "
+ + (mSystemSize + mUserdataSize));
}
installedSize = mUserdataSize;
+ MemoryFile memoryFile = new MemoryFile("dsu", READ_BUFFER_SIZE);
byte[] bytes = new byte[READ_BUFFER_SIZE];
-
+ mInstallationSession.setAshmem(
+ new ParcelFileDescriptor(memoryFile.getFileDescriptor()), READ_BUFFER_SIZE);
int numBytesRead;
-
Log.d(TAG, "Start installation loop");
while ((numBytesRead = mStream.read(bytes, 0, READ_BUFFER_SIZE)) != -1) {
+ memoryFile.writeBytes(bytes, 0, 0, numBytesRead);
if (isCancelled()) {
break;
}
-
- byte[] writeBuffer = numBytesRead == READ_BUFFER_SIZE
- ? bytes : Arrays.copyOf(bytes, numBytesRead);
-
- if (!mInstallationSession.write(writeBuffer)) {
+ if (!mInstallationSession.submitFromAshmem(numBytesRead)) {
throw new IOException("Failed write() to DynamicSystem");
}
@@ -157,7 +155,6 @@
reportedInstalledSize = installedSize;
}
}
-
return null;
} catch (Exception e) {
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index d2e0201..11b0487 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -29,6 +29,7 @@
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PRECISE_PHONE_STATE" />
+ <uses-permission android:name="android.permission.READ_ACTIVE_EMERGENCY_SESSION" />
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 18a8148..9acafae 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -495,7 +495,7 @@
* arg1 = One of the NETWORK_TESTED_RESULT_* constants.
* arg2 = NetID.
*/
- public static final int EVENT_NETWORK_TESTED = 41;
+ private static final int EVENT_NETWORK_TESTED = 41;
/**
* Event for NetworkMonitor/NetworkAgentInfo to inform ConnectivityService that the private DNS
@@ -503,7 +503,7 @@
* obj = PrivateDnsConfig
* arg2 = netid
*/
- public static final int EVENT_PRIVATE_DNS_CONFIG_RESOLVED = 42;
+ private static final int EVENT_PRIVATE_DNS_CONFIG_RESOLVED = 42;
/**
* Request ConnectivityService display provisioning notification.
@@ -511,12 +511,12 @@
* arg2 = NetID.
* obj = Intent to be launched when notification selected by user, null if !arg1.
*/
- public static final int EVENT_PROVISIONING_NOTIFICATION = 43;
+ private static final int EVENT_PROVISIONING_NOTIFICATION = 43;
/**
* This event can handle dismissing notification by given network id.
*/
- public static final int EVENT_TIMEOUT_NOTIFICATION = 44;
+ private static final int EVENT_TIMEOUT_NOTIFICATION = 44;
/**
* Used to specify whether a network should be used even if connectivity is partial.
@@ -531,13 +531,13 @@
* Argument for {@link #EVENT_PROVISIONING_NOTIFICATION} to indicate that the notification
* should be shown.
*/
- public static final int PROVISIONING_NOTIFICATION_SHOW = 1;
+ private static final int PROVISIONING_NOTIFICATION_SHOW = 1;
/**
* Argument for {@link #EVENT_PROVISIONING_NOTIFICATION} to indicate that the notification
* should be hidden.
*/
- public static final int PROVISIONING_NOTIFICATION_HIDE = 0;
+ private static final int PROVISIONING_NOTIFICATION_HIDE = 0;
private static String eventName(int what) {
return sMagicDecoderRing.get(what, Integer.toString(what));
@@ -1938,7 +1938,7 @@
}
}
- return mPolicyManagerInternal.isUidNetworkingBlocked(uid, uidRules,
+ return NetworkPolicyManagerInternal.isUidNetworkingBlocked(uid, uidRules,
isNetworkMetered, isBackgroundRestricted);
}
@@ -2204,7 +2204,7 @@
final String iface = networkAgent.linkProperties.getInterfaceName();
final int timeout;
- int type = ConnectivityManager.TYPE_NONE;
+ final int type;
if (networkAgent.networkCapabilities.hasTransport(
NetworkCapabilities.TRANSPORT_CELLULAR)) {
@@ -2219,11 +2219,10 @@
15);
type = ConnectivityManager.TYPE_WIFI;
} else {
- // do not track any other networks
- timeout = 0;
+ return; // do not track any other networks
}
- if (timeout > 0 && iface != null && type != ConnectivityManager.TYPE_NONE) {
+ if (timeout > 0 && iface != null) {
try {
mNMS.addIdleTimer(iface, timeout, type);
} catch (Exception e) {
@@ -2299,7 +2298,6 @@
@VisibleForTesting
protected static final String DEFAULT_TCP_BUFFER_SIZES = "4096,87380,110208,4096,16384,110208";
- private static final String DEFAULT_TCP_RWND_KEY = "net.tcp.default_init_rwnd";
private void updateTcpBufferSizes(String tcpBufferSizes) {
String[] values = null;
@@ -2375,7 +2373,8 @@
}
@Override
- protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
+ protected void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter writer,
+ @Nullable String[] args) {
PriorityDump.dump(mPriorityDumper, fd, writer, args);
}
@@ -2837,7 +2836,7 @@
private NetworkMonitorCallbacks(NetworkAgentInfo nai) {
mNetId = nai.network.netId;
- mNai = new AutodestructReference(nai);
+ mNai = new AutodestructReference<>(nai);
}
@Override
@@ -4292,7 +4291,7 @@
public void onChange(boolean selfChange, Uri uri) {
final Integer what = mUriEventMap.get(uri);
if (what != null) {
- mHandler.obtainMessage(what.intValue()).sendToTarget();
+ mHandler.obtainMessage(what).sendToTarget();
} else {
loge("No matching event to send for URI=" + uri);
}
@@ -4729,12 +4728,10 @@
private static final String ATTR_MNC = "mnc";
private String getProvisioningUrlBaseFromFile() {
- FileReader fileReader = null;
- XmlPullParser parser = null;
+ XmlPullParser parser;
Configuration config = mContext.getResources().getConfiguration();
- try {
- fileReader = new FileReader(mProvisioningUrlFile);
+ try (FileReader fileReader = new FileReader(mProvisioningUrlFile)) {
parser = Xml.newPullParser();
parser.setInput(fileReader);
XmlUtils.beginDocument(parser, TAG_PROVISIONING_URLS);
@@ -4769,12 +4766,6 @@
loge("Xml parser exception reading Carrier Provisioning Urls file: " + e);
} catch (IOException e) {
loge("I/O exception reading Carrier Provisioning Urls file: " + e);
- } finally {
- if (fileReader != null) {
- try {
- fileReader.close();
- } catch (IOException e) {}
- }
}
return null;
}
@@ -5104,8 +5095,8 @@
}
}
- // This checks that the passed capabilities either do not request a specific SSID/SignalStrength
- // , or the calling app has permission to do so.
+ // This checks that the passed capabilities either do not request a
+ // specific SSID/SignalStrength, or the calling app has permission to do so.
private void ensureSufficientPermissionsForRequest(NetworkCapabilities nc,
int callerPid, int callerUid) {
if (null != nc.getSSID() && !checkSettingsPermission(callerPid, callerUid)) {
@@ -5238,7 +5229,7 @@
final int uid = Binder.getCallingUid();
Integer uidReqs = mBandwidthRequests.get(uid);
if (uidReqs == null) {
- uidReqs = new Integer(0);
+ uidReqs = 0;
}
mBandwidthRequests.put(uid, ++uidReqs);
}
@@ -5572,7 +5563,7 @@
}
private void updateLinkProperties(NetworkAgentInfo networkAgent, LinkProperties newLp,
- LinkProperties oldLp) {
+ @NonNull LinkProperties oldLp) {
int netId = networkAgent.network.netId;
// The NetworkAgentInfo does not know whether clatd is running on its network or not, or
@@ -5687,7 +5678,7 @@
*/
private boolean updateRoutes(LinkProperties newLp, LinkProperties oldLp, int netId) {
// Compare the route diff to determine which routes should be added and removed.
- CompareResult<RouteInfo> routeDiff = new CompareResult<RouteInfo>(
+ CompareResult<RouteInfo> routeDiff = new CompareResult<>(
oldLp != null ? oldLp.getAllRoutes() : null,
newLp != null ? newLp.getAllRoutes() : null);
@@ -5706,7 +5697,7 @@
}
}
for (RouteInfo route : routeDiff.added) {
- if (route.hasGateway() == false) continue;
+ if (!route.hasGateway()) continue;
if (VDBG || DDBG) log("Adding Route [" + route + "] to network " + netId);
try {
mNMS.addRoute(netId, route);
@@ -5935,8 +5926,8 @@
* 3. the VPN is fully-routed
* 4. the VPN interface is non-null
*
- * @See INetd#firewallAddUidInterfaceRules
- * @See INetd#firewallRemoveUidInterfaceRules
+ * @see INetd#firewallAddUidInterfaceRules
+ * @see INetd#firewallRemoveUidInterfaceRules
*/
private boolean requiresVpnIsolation(@NonNull NetworkAgentInfo nai, NetworkCapabilities nc,
LinkProperties lp) {
@@ -7051,9 +7042,9 @@
}
@Override
- public void onShellCommand(FileDescriptor in, FileDescriptor out,
- FileDescriptor err, String[] args, ShellCallback callback,
- ResultReceiver resultReceiver) {
+ public void onShellCommand(@NonNull FileDescriptor in, @NonNull FileDescriptor out,
+ FileDescriptor err, @NonNull String[] args, ShellCallback callback,
+ @NonNull ResultReceiver resultReceiver) {
(new ShellCmd()).exec(this, in, out, err, args, callback, resultReceiver);
}
diff --git a/services/core/java/com/android/server/DynamicSystemService.java b/services/core/java/com/android/server/DynamicSystemService.java
index 173d5b0..18009e1 100644
--- a/services/core/java/com/android/server/DynamicSystemService.java
+++ b/services/core/java/com/android/server/DynamicSystemService.java
@@ -25,6 +25,7 @@
import android.os.Environment;
import android.os.IBinder;
import android.os.IBinder.DeathRecipient;
+import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
@@ -181,28 +182,34 @@
@Override
public boolean remove() throws RemoteException {
- return getGsiService().removeGsiInstall();
+ return getGsiService().removeGsi();
}
@Override
- public boolean setEnable(boolean enable) throws RemoteException {
+ public boolean setEnable(boolean enable, boolean oneShot) throws RemoteException {
IGsiService gsiService = getGsiService();
if (enable) {
- final int status = gsiService.getGsiBootStatus();
- final boolean singleBoot = (status == IGsiService.BOOT_STATUS_SINGLE_BOOT);
- return gsiService.setGsiBootable(singleBoot) == 0;
+ return gsiService.enableGsi(oneShot) == 0;
} else {
- return gsiService.disableGsiInstall();
+ return gsiService.disableGsi();
}
}
@Override
- public boolean write(byte[] buf) throws RemoteException {
- return getGsiService().commitGsiChunkFromMemory(buf);
+ public boolean setAshmem(ParcelFileDescriptor ashmem, long size) {
+ try {
+ return getGsiService().setGsiAshmem(ashmem, size);
+ } catch (RemoteException e) {
+ throw new RuntimeException(e.toString());
+ }
}
@Override
- public boolean commit() throws RemoteException {
- return getGsiService().setGsiBootable(true) == 0;
+ public boolean submitFromAshmem(long size) {
+ try {
+ return getGsiService().commitGsiChunkFromAshmem(size);
+ } catch (RemoteException e) {
+ throw new RuntimeException(e.toString());
+ }
}
}
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 4e8a74c..cfd2503 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -209,6 +209,10 @@
private Map<Integer, List<EmergencyNumber>> mEmergencyNumberList;
+ private EmergencyNumber[] mOutgoingSmsEmergencyNumber;
+
+ private EmergencyNumber[] mOutgoingCallEmergencyNumber;
+
private CallQuality[] mCallQuality;
private CallAttributes[] mCallAttributes;
@@ -267,6 +271,10 @@
PhoneStateListener.LISTEN_PRECISE_CALL_STATE |
PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE;
+ static final int READ_ACTIVE_EMERGENCY_SESSION_PERMISSION_MASK =
+ PhoneStateListener.LISTEN_OUTGOING_CALL_EMERGENCY_NUMBER
+ | PhoneStateListener.LISTEN_OUTGOING_SMS_EMERGENCY_NUMBER;
+
private static final int MSG_USER_SWITCHED = 1;
private static final int MSG_UPDATE_DEFAULT_SUB = 2;
@@ -407,6 +415,8 @@
mImsReasonInfo = new ArrayList<>();
mPhysicalChannelConfigs = new ArrayList<>();
mEmergencyNumberList = new HashMap<>();
+ mOutgoingCallEmergencyNumber = new EmergencyNumber[numPhones];
+ mOutgoingSmsEmergencyNumber = new EmergencyNumber[numPhones];
for (int i = 0; i < numPhones; i++) {
mCallState[i] = TelephonyManager.CALL_STATE_IDLE;
mDataActivity[i] = TelephonyManager.DATA_ACTIVITY_NONE;
@@ -1928,6 +1938,56 @@
}
@Override
+ public void notifyOutgoingEmergencyCall(int phoneId, int subId,
+ EmergencyNumber emergencyNumber) {
+ if (!checkNotifyPermission("notifyOutgoingEmergencyCall()")) {
+ return;
+ }
+ synchronized (mRecords) {
+ if (validatePhoneId(phoneId)) {
+ mOutgoingCallEmergencyNumber[phoneId] = emergencyNumber;
+ for (Record r : mRecords) {
+ if (r.matchPhoneStateListenerEvent(
+ PhoneStateListener.LISTEN_OUTGOING_CALL_EMERGENCY_NUMBER)
+ && idMatch(r.subId, subId, phoneId)) {
+ try {
+ r.callback.onOutgoingEmergencyCall(emergencyNumber);
+ } catch (RemoteException ex) {
+ mRemoveList.add(r.binder);
+ }
+ }
+ }
+ }
+ handleRemoveListLocked();
+ }
+ }
+
+ @Override
+ public void notifyOutgoingEmergencySms(int phoneId, int subId,
+ EmergencyNumber emergencyNumber) {
+ if (!checkNotifyPermission("notifyOutgoingEmergencySms()")) {
+ return;
+ }
+ synchronized (mRecords) {
+ if (validatePhoneId(phoneId)) {
+ mOutgoingSmsEmergencyNumber[phoneId] = emergencyNumber;
+ for (Record r : mRecords) {
+ if (r.matchPhoneStateListenerEvent(
+ PhoneStateListener.LISTEN_OUTGOING_SMS_EMERGENCY_NUMBER)
+ && idMatch(r.subId, subId, phoneId)) {
+ try {
+ r.callback.onOutgoingEmergencySms(emergencyNumber);
+ } catch (RemoteException ex) {
+ mRemoveList.add(r.binder);
+ }
+ }
+ }
+ }
+ handleRemoveListLocked();
+ }
+ }
+
+ @Override
public void notifyCallQualityChanged(CallQuality callQuality, int phoneId, int subId,
int callNetworkType) {
if (!checkNotifyPermission("notifyCallQualityChanged()")) {
@@ -1999,6 +2059,8 @@
pw.println("mCallAttributes=" + mCallAttributes[i]);
pw.println("mCallNetworkType=" + mCallNetworkType[i]);
pw.println("mPreciseDataConnectionState=" + mPreciseDataConnectionState[i]);
+ pw.println("mOutgoingCallEmergencyNumber=" + mOutgoingCallEmergencyNumber[i]);
+ pw.println("mOutgoingSmsEmergencyNumber=" + mOutgoingSmsEmergencyNumber[i]);
pw.decreaseIndent();
}
pw.println("mCarrierNetworkChangeState=" + mCarrierNetworkChangeState);
@@ -2268,6 +2330,11 @@
android.Manifest.permission.READ_PRECISE_PHONE_STATE, null);
}
+ if ((events & READ_ACTIVE_EMERGENCY_SESSION_PERMISSION_MASK) != 0) {
+ mContext.enforceCallingOrSelfPermission(
+ android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION, null);
+ }
+
if ((events & PhoneStateListener.LISTEN_OEM_HOOK_RAW_EVENT) != 0) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
diff --git a/services/core/java/com/android/server/connectivity/Nat464Xlat.java b/services/core/java/com/android/server/connectivity/Nat464Xlat.java
index 66bd27c..aea6d8d 100644
--- a/services/core/java/com/android/server/connectivity/Nat464Xlat.java
+++ b/services/core/java/com/android/server/connectivity/Nat464Xlat.java
@@ -16,6 +16,7 @@
package com.android.server.connectivity;
+import android.annotation.NonNull;
import android.net.ConnectivityManager;
import android.net.IDnsResolver;
import android.net.INetd;
@@ -325,13 +326,13 @@
* This is necessary because the LinkProperties in mNetwork come from the transport layer, which
* has no idea that 464xlat is running on top of it.
*/
- public void fixupLinkProperties(LinkProperties oldLp, LinkProperties lp) {
+ public void fixupLinkProperties(@NonNull LinkProperties oldLp, @NonNull LinkProperties lp) {
lp.setNat64Prefix(mNat64Prefix);
if (!isRunning()) {
return;
}
- if (lp == null || lp.getAllInterfaceNames().contains(mIface)) {
+ if (lp.getAllInterfaceNames().contains(mIface)) {
return;
}
@@ -434,7 +435,7 @@
@Override
public void interfaceRemoved(String iface) {
- mNetwork.handler().post(() -> { handleInterfaceRemoved(iface); });
+ mNetwork.handler().post(() -> handleInterfaceRemoved(iface));
}
@Override
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 063ad75..09790c4 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -199,13 +199,22 @@
*/
private @NonNull List<String> mLockdownWhitelist = Collections.emptyList();
- /**
- * List of UIDs for which networking should be blocked until VPN is ready, during brief periods
- * when VPN is not running. For example, during system startup or after a crash.
+ /**
+ * A memory of what UIDs this class told netd to block for the lockdown feature.
+ *
+ * Netd maintains ranges of UIDs for which network should be restricted to using only the VPN
+ * for the lockdown feature. This class manages these UIDs and sends this information to netd.
+ * To avoid sending the same commands multiple times (which would be wasteful) and to be able
+ * to revoke lists (when the rules should change), it's simplest to keep this cache of what
+ * netd knows, so it can be diffed and sent most efficiently.
+ *
+ * The contents of this list must only be changed when updating the UIDs lists with netd,
+ * since it needs to keep in sync with the picture netd has of them.
+ *
* @see mLockdown
*/
@GuardedBy("this")
- private Set<UidRange> mBlockedUsers = new ArraySet<>();
+ private final Set<UidRange> mBlockedUidsAsToldToNetd = new ArraySet<>();
// Handle of the user initiating VPN.
private final int mUserHandle;
@@ -254,7 +263,7 @@
}
/**
- * Update current state, dispaching event to listeners.
+ * Update current state, dispatching event to listeners.
*/
@VisibleForTesting
protected void updateState(DetailedState detailedState, String reason) {
@@ -1325,7 +1334,7 @@
* {@link Vpn} goes through a VPN connection or is blocked until one is
* available, {@code false} to lift the requirement.
*
- * @see #mBlockedUsers
+ * @see #mBlockedUidsAsToldToNetd
*/
@GuardedBy("this")
private void setVpnForcedLocked(boolean enforce) {
@@ -1336,37 +1345,47 @@
exemptedPackages = new ArrayList<>(mLockdownWhitelist);
exemptedPackages.add(mPackage);
}
- final Set<UidRange> removedRanges = new ArraySet<>(mBlockedUsers);
+ final Set<UidRange> rangesToTellNetdToRemove = new ArraySet<>(mBlockedUidsAsToldToNetd);
- Set<UidRange> addedRanges = Collections.emptySet();
+ final Set<UidRange> rangesToTellNetdToAdd;
if (enforce) {
- addedRanges = createUserAndRestrictedProfilesRanges(mUserHandle,
- /* allowedApplications */ null,
- /* disallowedApplications */ exemptedPackages);
+ final Set<UidRange> rangesThatShouldBeBlocked =
+ createUserAndRestrictedProfilesRanges(mUserHandle,
+ /* allowedApplications */ null,
+ /* disallowedApplications */ exemptedPackages);
// The UID range of the first user (0-99999) would block the IPSec traffic, which comes
// directly from the kernel and is marked as uid=0. So we adjust the range to allow
// it through (b/69873852).
- for (UidRange range : addedRanges) {
+ for (UidRange range : rangesThatShouldBeBlocked) {
if (range.start == 0) {
- addedRanges.remove(range);
+ rangesThatShouldBeBlocked.remove(range);
if (range.stop != 0) {
- addedRanges.add(new UidRange(1, range.stop));
+ rangesThatShouldBeBlocked.add(new UidRange(1, range.stop));
}
}
}
- removedRanges.removeAll(addedRanges);
- addedRanges.removeAll(mBlockedUsers);
+ rangesToTellNetdToRemove.removeAll(rangesThatShouldBeBlocked);
+ rangesToTellNetdToAdd = rangesThatShouldBeBlocked;
+ // The ranges to tell netd to add are the ones that should be blocked minus the
+ // ones it already knows to block. Note that this will change the contents of
+ // rangesThatShouldBeBlocked, but the list of ranges that should be blocked is
+ // not used after this so it's fine to destroy it.
+ rangesToTellNetdToAdd.removeAll(mBlockedUidsAsToldToNetd);
+ } else {
+ rangesToTellNetdToAdd = Collections.emptySet();
}
- setAllowOnlyVpnForUids(false, removedRanges);
- setAllowOnlyVpnForUids(true, addedRanges);
+ // If mBlockedUidsAsToldToNetd used to be empty, this will always be a no-op.
+ setAllowOnlyVpnForUids(false, rangesToTellNetdToRemove);
+ // If nothing should be blocked now, this will now be a no-op.
+ setAllowOnlyVpnForUids(true, rangesToTellNetdToAdd);
}
/**
- * Either add or remove a list of {@link UidRange}s to the list of UIDs that are only allowed
- * to make connections through sockets that have had {@code protect()} called on them.
+ * Tell netd to add or remove a list of {@link UidRange}s to the list of UIDs that are only
+ * allowed to make connections through sockets that have had {@code protect()} called on them.
*
* @param enforce {@code true} to add to the blacklist, {@code false} to remove.
* @param ranges {@link Collection} of {@link UidRange}s to add (if {@param enforce} is
@@ -1388,9 +1407,9 @@
return false;
}
if (enforce) {
- mBlockedUsers.addAll(ranges);
+ mBlockedUidsAsToldToNetd.addAll(ranges);
} else {
- mBlockedUsers.removeAll(ranges);
+ mBlockedUidsAsToldToNetd.removeAll(ranges);
}
return true;
}
@@ -1557,17 +1576,18 @@
/**
* @param uid The target uid.
*
- * @return {@code true} if {@code uid} is included in one of the mBlockedUsers ranges and the
- * VPN is not connected, or if the VPN is connected but does not apply to the {@code uid}.
+ * @return {@code true} if {@code uid} is included in one of the mBlockedUidsAsToldToNetd
+ * ranges and the VPN is not connected, or if the VPN is connected but does not apply to
+ * the {@code uid}.
*
* @apiNote This method don't check VPN lockdown status.
- * @see #mBlockedUsers
+ * @see #mBlockedUidsAsToldToNetd
*/
public synchronized boolean isBlockingUid(int uid) {
if (mNetworkInfo.isConnected()) {
return !appliesToUid(uid);
} else {
- return UidRange.containsUid(mBlockedUsers, uid);
+ return UidRange.containsUid(mBlockedUidsAsToldToNetd, uid);
}
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
index 49af15f..44338ac 100644
--- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
+++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
@@ -756,7 +756,7 @@
(!listThirdParty || !isSystem) &&
(!listApexOnly || isApex)) {
pw.print("package:");
- if (showSourceDir && !isApex) {
+ if (showSourceDir) {
pw.print(info.applicationInfo.sourceDir);
pw.print("=");
}
diff --git a/services/core/java/com/android/server/pm/SELinuxMMAC.java b/services/core/java/com/android/server/pm/SELinuxMMAC.java
index b94047e..b464988 100644
--- a/services/core/java/com/android/server/pm/SELinuxMMAC.java
+++ b/services/core/java/com/android/server/pm/SELinuxMMAC.java
@@ -78,6 +78,13 @@
sMacPermissions.add(new File(
Environment.getRootDirectory(), "/etc/selinux/plat_mac_permissions.xml"));
+ // SystemExt mac permissions (optional).
+ final File systemExtMacPermission = new File(
+ Environment.getSystemExtDirectory(), "/etc/selinux/system_ext_mac_permissions.xml");
+ if (systemExtMacPermission.exists()) {
+ sMacPermissions.add(systemExtMacPermission);
+ }
+
// Product mac permissions (optional).
final File productMacPermission = new File(
Environment.getProductDirectory(), "/etc/selinux/product_mac_permissions.xml");
diff --git a/services/net/java/android/net/netlink/InetDiagMessage.java b/services/net/java/android/net/netlink/InetDiagMessage.java
index af9e601..31a2556 100644
--- a/services/net/java/android/net/netlink/InetDiagMessage.java
+++ b/services/net/java/android/net/netlink/InetDiagMessage.java
@@ -16,26 +16,23 @@
package android.net.netlink;
-import static android.os.Process.INVALID_UID;
import static android.net.netlink.NetlinkConstants.SOCK_DIAG_BY_FAMILY;
import static android.net.netlink.NetlinkSocket.DEFAULT_RECV_BUFSIZE;
import static android.net.netlink.StructNlMsgHdr.NLM_F_DUMP;
import static android.net.netlink.StructNlMsgHdr.NLM_F_REQUEST;
+import static android.os.Process.INVALID_UID;
import static android.system.OsConstants.AF_INET;
import static android.system.OsConstants.AF_INET6;
import static android.system.OsConstants.IPPROTO_UDP;
import static android.system.OsConstants.NETLINK_INET_DIAG;
-import android.os.Build;
-import android.os.Process;
+import android.net.util.SocketUtils;
import android.system.ErrnoException;
import android.util.Log;
import java.io.FileDescriptor;
+import java.io.IOException;
import java.io.InterruptedIOException;
-import java.net.DatagramSocket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetSocketAddress;
@@ -163,17 +160,25 @@
*/
public static int getConnectionOwnerUid(int protocol, InetSocketAddress local,
InetSocketAddress remote) {
+ int uid = INVALID_UID;
+ FileDescriptor fd = null;
try {
- final FileDescriptor fd = NetlinkSocket.forProto(NETLINK_INET_DIAG);
+ fd = NetlinkSocket.forProto(NETLINK_INET_DIAG);
NetlinkSocket.connectToKernel(fd);
-
- return lookupUid(protocol, local, remote, fd);
-
+ uid = lookupUid(protocol, local, remote, fd);
} catch (ErrnoException | SocketException | IllegalArgumentException
| InterruptedIOException e) {
Log.e(TAG, e.toString());
+ } finally {
+ if (fd != null) {
+ try {
+ SocketUtils.closeSocket(fd);
+ } catch (IOException e) {
+ Log.e(TAG, e.toString());
+ }
+ }
}
- return INVALID_UID;
+ return uid;
}
@Override
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 1822cee..5e71416 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -19,6 +19,7 @@
import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.SystemApi;
+import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.net.Uri;
import android.os.Build;
@@ -119,6 +120,20 @@
public static final int STATE_PULLING_CALL = 11;
/**
+ * The state of a call that is active with the network, but the audio from the call is
+ * being intercepted by an app on the local device. Telecom does not hold audio focus in this
+ * state, and the call will be invisible to the user except for a persistent notification.
+ */
+ public static final int STATE_AUDIO_PROCESSING = 12;
+
+ /**
+ * The state of a call that is being presented to the user after being in
+ * {@link #STATE_AUDIO_PROCESSING}. The call is still active with the network in this case, and
+ * Telecom will hold audio focus and play a ringtone if appropriate.
+ */
+ public static final int STATE_SIMULATED_RINGING = 13;
+
+ /**
* The key to retrieve the optional {@code PhoneAccount}s Telecom can bundle with its Call
* extras. Used to pass the phone accounts to display on the front end to the user in order to
* select phone accounts to (for example) place a call.
@@ -1479,6 +1494,49 @@
}
/**
+ * Instructs Telecom to put the call into the background audio processing state.
+ *
+ * This method can be called either when the call is in {@link #STATE_RINGING} or
+ * {@link #STATE_ACTIVE}. After Telecom acknowledges the request by setting the call's state to
+ * {@link #STATE_AUDIO_PROCESSING}, your app may setup the audio paths with the audio stack in
+ * order to capture and play audio on the call stream.
+ *
+ * This method can only be called by the default dialer app.
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ //@RequiresPermission(android.Manifest.permission.BACKGROUND_CALL_AUDIO)
+ public void enterBackgroundAudioProcessing() {
+ if (mState != STATE_ACTIVE && mState != STATE_RINGING) {
+ throw new IllegalStateException("Call must be active or ringing");
+ }
+ mInCallAdapter.enterBackgroundAudioProcessing(mTelecomCallId);
+ }
+
+ /**
+ * Instructs Telecom to come out of the background audio processing state requested by
+ * {@link #enterBackgroundAudioProcessing()} or from the call screening service.
+ *
+ * This method can only be called when the call is in {@link #STATE_AUDIO_PROCESSING}.
+ *
+ * @param shouldRing If true, Telecom will put the call into the
+ * {@link #STATE_SIMULATED_RINGING} state and notify other apps that there is
+ * a ringing call. Otherwise, the call will go into {@link #STATE_ACTIVE}
+ * immediately.
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ //@RequiresPermission(android.Manifest.permission.BACKGROUND_CALL_AUDIO)
+ public void exitBackgroundAudioProcessing(boolean shouldRing) {
+ if (mState != STATE_AUDIO_PROCESSING) {
+ throw new IllegalStateException("Call must in the audio processing state");
+ }
+ mInCallAdapter.exitBackgroundAudioProcessing(mTelecomCallId, shouldRing);
+ }
+
+ /**
* Instructs this {@code Call} to play a dual-tone multi-frequency signaling (DTMF) tone.
*
* Any other currently playing DTMF tone in the specified call is immediately stopped.
diff --git a/telecomm/java/android/telecom/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java
index e4f8d11..0d97567 100644
--- a/telecomm/java/android/telecom/CallScreeningService.java
+++ b/telecomm/java/android/telecom/CallScreeningService.java
@@ -18,6 +18,8 @@
import android.annotation.NonNull;
import android.annotation.SdkConstant;
+import android.annotation.SystemApi;
+import android.annotation.TestApi;
import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
@@ -136,23 +138,30 @@
private final boolean mShouldSilenceCall;
private final boolean mShouldSkipCallLog;
private final boolean mShouldSkipNotification;
+ private final boolean mShouldScreenCallFurther;
private CallResponse(
boolean shouldDisallowCall,
boolean shouldRejectCall,
boolean shouldSilenceCall,
boolean shouldSkipCallLog,
- boolean shouldSkipNotification) {
+ boolean shouldSkipNotification,
+ boolean shouldScreenCallFurther) {
if (!shouldDisallowCall
&& (shouldRejectCall || shouldSkipCallLog || shouldSkipNotification)) {
throw new IllegalStateException("Invalid response state for allowed call.");
}
+ if (shouldDisallowCall && shouldScreenCallFurther) {
+ throw new IllegalStateException("Invalid response state for allowed call.");
+ }
+
mShouldDisallowCall = shouldDisallowCall;
mShouldRejectCall = shouldRejectCall;
mShouldSkipCallLog = shouldSkipCallLog;
mShouldSkipNotification = shouldSkipNotification;
mShouldSilenceCall = shouldSilenceCall;
+ mShouldScreenCallFurther = shouldScreenCallFurther;
}
/*
@@ -191,12 +200,22 @@
return mShouldSkipNotification;
}
+ /**
+ * @return Whether we should enter the {@link Call#STATE_AUDIO_PROCESSING} state to allow
+ * for further screening of the call.
+ * @hide
+ */
+ public boolean getShouldScreenCallFurther() {
+ return mShouldScreenCallFurther;
+ }
+
public static class Builder {
private boolean mShouldDisallowCall;
private boolean mShouldRejectCall;
private boolean mShouldSilenceCall;
private boolean mShouldSkipCallLog;
private boolean mShouldSkipNotification;
+ private boolean mShouldScreenCallFurther;
/**
* Sets whether the incoming call should be blocked.
@@ -252,13 +271,32 @@
return this;
}
+ /**
+ * Sets whether to request background audio processing so that the in-call service can
+ * screen the call further. If set to {@code true}, {@link #setDisallowCall} should be
+ * called with {@code false}, and all other parameters in this builder will be ignored.
+ *
+ * This request will only be honored if the {@link CallScreeningService} shares the same
+ * uid as the default dialer app. Otherwise, the call will go through as usual.
+ *
+ * @param shouldScreenCallFurther Whether to request further call screening.
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public Builder setShouldScreenCallFurther(boolean shouldScreenCallFurther) {
+ mShouldScreenCallFurther = shouldScreenCallFurther;
+ return this;
+ }
+
public CallResponse build() {
return new CallResponse(
mShouldDisallowCall,
mShouldRejectCall,
mShouldSilenceCall,
mShouldSkipCallLog,
- mShouldSkipNotification);
+ mShouldSkipNotification,
+ mShouldScreenCallFurther);
}
}
}
diff --git a/telecomm/java/android/telecom/InCallAdapter.java b/telecomm/java/android/telecom/InCallAdapter.java
index 8678e33..2612468 100644
--- a/telecomm/java/android/telecom/InCallAdapter.java
+++ b/telecomm/java/android/telecom/InCallAdapter.java
@@ -16,8 +16,8 @@
package android.telecom;
-import android.net.Uri;
import android.bluetooth.BluetoothDevice;
+import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
@@ -149,6 +149,26 @@
}
/**
+ * @see Call#enterBackgroundAudioProcessing()
+ */
+ public void enterBackgroundAudioProcessing(String callId) {
+ try {
+ mAdapter.enterBackgroundAudioProcessing(callId);
+ } catch (RemoteException e) {
+ }
+ }
+
+ /**
+ * @see Call#exitBackgroundAudioProcessing(boolean)
+ */
+ public void exitBackgroundAudioProcessing(String callId, boolean shouldRing) {
+ try {
+ mAdapter.exitBackgroundAudioProcessing(callId, shouldRing);
+ } catch (RemoteException e) {
+ }
+ }
+
+ /**
* Request audio routing to a specific bluetooth device. Calling this method may result in
* the device routing audio to a different bluetooth device than the one specified. A list of
* available devices can be obtained via {@link CallAudioState#getSupportedBluetoothDevices()}
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 6409203..12066c4 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -2059,12 +2059,13 @@
/**
* Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
* @param intent The {@link Intent#ACTION_CALL} intent to handle.
+ * @param callingPackageProxy The original package that called this before it was trampolined.
* @hide
*/
- public void handleCallIntent(Intent intent) {
+ public void handleCallIntent(Intent intent, String callingPackageProxy) {
try {
if (isServiceConnected()) {
- getTelecomService().handleCallIntent(intent);
+ getTelecomService().handleCallIntent(intent, callingPackageProxy);
}
} catch (RemoteException e) {
Log.e(TAG, "RemoteException handleCallIntent: " + e);
diff --git a/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl b/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl
index 3ee3285..83c8f62 100644
--- a/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl
@@ -30,6 +30,8 @@
void silenceCall(String callId);
+ void screenCallFurther(String callId);
+
void disallowCall(
String callId,
boolean shouldReject,
diff --git a/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl b/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl
index 57df5c1..60745e4 100644
--- a/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl
@@ -44,6 +44,10 @@
void setAudioRoute(int route, String bluetoothAddress);
+ void enterBackgroundAudioProcessing(String callId);
+
+ void exitBackgroundAudioProcessing(String callId, boolean shouldRing);
+
void playDtmfTone(String callId, char digit);
void stopDtmfTone(String callId);
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 4fcda4d..6a1b78f 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -282,6 +282,11 @@
void acceptHandover(in Uri srcAddr, int videoState, in PhoneAccountHandle destAcct);
/**
+ * @see TelecomServiceImpl#setTestEmergencyPhoneAccountPackageNameFilter
+ */
+ void setTestEmergencyPhoneAccountPackageNameFilter(String packageName);
+
+ /**
* @see TelecomServiceImpl#isInEmergencyCall
*/
boolean isInEmergencyCall();
@@ -289,7 +294,7 @@
/**
* @see TelecomServiceImpl#handleCallIntent
*/
- void handleCallIntent(in Intent intent);
+ void handleCallIntent(in Intent intent, in String callingPackageProxy);
void setTestDefaultCallRedirectionApp(String packageName);
@@ -302,6 +307,11 @@
void setTestAutoModeApp(String packageName);
/**
+ * @see TelecomServiceImpl#setSystemDialer
+ */
+ void setSystemDialer(in ComponentName testComponentName);
+
+ /**
* @see TelecomServiceImpl#setTestDefaultDialer
*/
void setTestDefaultDialer(in String packageName);
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index f475822..4f6d2d4 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1031,6 +1031,18 @@
"call_forwarding_map_non_number_to_voicemail_bool";
/**
+ * When {@code true}, the phone will always tell the IMS stack to keep RTT enabled and
+ * determine on a per-call basis (based on extras from the dialer app) whether a call should be
+ * an RTT call or not.
+ *
+ * When {@code false}, the old behavior is used, where the toggle in accessibility settings is
+ * used to set the IMS stack's RTT enabled state.
+ * @hide
+ */
+ public static final String KEY_IGNORE_RTT_MODE_SETTING_BOOL =
+ "ignore_rtt_mode_setting_bool";
+
+ /**
* Determines whether conference calls are supported by a carrier. When {@code true},
* conference calling is supported, {@code false otherwise}.
*/
@@ -1705,9 +1717,8 @@
"allow_emergency_video_calls_bool";
/**
- * Flag indicating whether the carrier supports RCS presence indication for video calls. When
- * {@code true}, the carrier supports RCS presence indication for video calls. When presence
- * is supported, the device should use the
+ * Flag indicating whether the carrier supports RCS presence indication for
+ * User Capability Exchange (UCE). When presence is supported, the device should use the
* {@link android.provider.ContactsContract.Data#CARRIER_PRESENCE} bit mask and set the
* {@link android.provider.ContactsContract.Data#CARRIER_PRESENCE_VT_CAPABLE} bit to indicate
* whether each contact supports video calling. The UI is made aware that presence is enabled
@@ -1718,6 +1729,12 @@
public static final String KEY_USE_RCS_PRESENCE_BOOL = "use_rcs_presence_bool";
/**
+ * Flag indicating whether the carrier supports RCS SIP OPTIONS indication for
+ * User Capability Exchange (UCE).
+ */
+ public static final String KEY_USE_RCS_SIP_OPTIONS_BOOL = "use_rcs_sip_options_bool";
+
+ /**
* The duration in seconds that platform call and message blocking is disabled after the user
* contacts emergency services. Platform considers values for below cases:
* 1) 0 <= VALUE <= 604800(one week): the value will be used as the duration directly.
@@ -3249,6 +3266,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, 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);
@@ -3328,6 +3346,7 @@
sDefaults.putBoolean(KEY_ALLOW_NON_EMERGENCY_CALLS_IN_ECM_BOOL, true);
sDefaults.putInt(KEY_EMERGENCY_SMS_MODE_TIMER_MS_INT, 0);
sDefaults.putBoolean(KEY_USE_RCS_PRESENCE_BOOL, false);
+ sDefaults.putBoolean(KEY_USE_RCS_SIP_OPTIONS_BOOL, false);
sDefaults.putBoolean(KEY_FORCE_IMEI_BOOL, false);
sDefaults.putInt(
KEY_CDMA_ROAMING_MODE_INT, TelephonyManager.CDMA_ROAMING_MODE_RADIO_DEFAULT);
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index fe882ea..2c4d59d 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -20,6 +20,7 @@
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
+import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.os.Binder;
import android.os.Build;
@@ -371,6 +372,7 @@
* @hide
*/
@SystemApi
+ @TestApi
@RequiresPermission(Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION)
public static final int LISTEN_OUTGOING_CALL_EMERGENCY_NUMBER = 0x10000000;
@@ -383,6 +385,7 @@
* @hide
*/
@SystemApi
+ @TestApi
@RequiresPermission(Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION)
public static final int LISTEN_OUTGOING_SMS_EMERGENCY_NUMBER = 0x20000000;
@@ -874,6 +877,7 @@
* to.
* @hide
*/
+ @SystemApi
public void onOutgoingEmergencyCall(@NonNull EmergencyNumber placedEmergencyNumber) {
// default implementation empty
}
@@ -884,6 +888,7 @@
* @param sentEmergencyNumber the emergency number {@link EmergencyNumber} the SMS is sent to.
* @hide
*/
+ @SystemApi
public void onOutgoingEmergencySms(@NonNull EmergencyNumber sentEmergencyNumber) {
// default implementation empty
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 8bd8625..7e6e8f4 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -11125,6 +11125,8 @@
* The {@link #EXTRA_NETWORK_COUNTRY} extra indicates the country code of the current
* network returned by {@link #getNetworkCountryIso()}.
*
+ * <p>There may be a delay of several minutes before reporting that no country is detected.
+ *
* @see #EXTRA_NETWORK_COUNTRY
* @see #getNetworkCountryIso()
*/
diff --git a/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java
index 5f2f75d..02429b5 100644
--- a/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java
+++ b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java
@@ -16,12 +16,19 @@
package android.telephony.cdma;
+import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
/**
- * CDMA Service Category Program Data from SCPT teleservice SMS.
+ * CDMA Service Category Program Data from SCPT (Service Category Programming Teleservice) SMS,
+ * as defined in 3GPP2 C.S0015-B section 4.5.19.
+ * <p>
* The CellBroadcastReceiver app receives an Intent with action
* {@link android.provider.Telephony.Sms.Intents#SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION}
* containing an array of these objects to update its list of cell broadcast service categories
@@ -29,6 +36,7 @@
*
* {@hide}
*/
+@SystemApi
public final class CdmaSmsCbProgramData implements Parcelable {
/** Delete the specified service category from the list of enabled categories. */
@@ -40,40 +48,83 @@
/** Clear all service categories from the list of enabled categories. */
public static final int OPERATION_CLEAR_CATEGORIES = 2;
- /** Alert option: no alert. */
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"OPERATION_"},
+ value = {
+ OPERATION_DELETE_CATEGORY,
+ OPERATION_ADD_CATEGORY,
+ OPERATION_CLEAR_CATEGORIES,
+ })
+ public @interface Operation {}
+
+ // CMAS alert service category assignments, see 3GPP2 C.R1001 table 9.3.3-1
+ /** Indicates a presidential-level alert */
+ public static final int CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT = 0x1000;
+
+ /** Indicates an extreme threat to life and property */
+ public static final int CATEGORY_CMAS_EXTREME_THREAT = 0x1001;
+
+ /** Indicates an severe threat to life and property */
+ public static final int CATEGORY_CMAS_SEVERE_THREAT = 0x1002;
+
+ /** Indicates an AMBER child abduction emergency */
+ public static final int CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY = 0x1003;
+
+ /** Indicates a CMAS test message */
+ public static final int CATEGORY_CMAS_TEST_MESSAGE = 0x1004;
+
+ /** The last reserved value of a CMAS service category according to 3GPP C.R1001 table
+ * 9.3.3-1. */
+ public static final int CATEGORY_CMAS_LAST_RESERVED_VALUE = 0x10ff;
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"CATEGORY_"},
+ value = {
+ CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT,
+ CATEGORY_CMAS_EXTREME_THREAT,
+ CATEGORY_CMAS_SEVERE_THREAT,
+ CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY,
+ CATEGORY_CMAS_TEST_MESSAGE,
+ CATEGORY_CMAS_LAST_RESERVED_VALUE,
+ })
+ public @interface Category {}
+
+ /** Alert option: no alert. @hide */
public static final int ALERT_OPTION_NO_ALERT = 0;
- /** Alert option: default alert. */
+ /** Alert option: default alert. @hide */
public static final int ALERT_OPTION_DEFAULT_ALERT = 1;
- /** Alert option: vibrate alert once. */
+ /** Alert option: vibrate alert once. @hide */
public static final int ALERT_OPTION_VIBRATE_ONCE = 2;
- /** Alert option: vibrate alert - repeat. */
+ /** Alert option: vibrate alert - repeat. @hide */
public static final int ALERT_OPTION_VIBRATE_REPEAT = 3;
- /** Alert option: visual alert once. */
+ /** Alert option: visual alert once. @hide */
public static final int ALERT_OPTION_VISUAL_ONCE = 4;
- /** Alert option: visual alert - repeat. */
+ /** Alert option: visual alert - repeat. @hide */
public static final int ALERT_OPTION_VISUAL_REPEAT = 5;
- /** Alert option: low-priority alert once. */
+ /** Alert option: low-priority alert once. @hide */
public static final int ALERT_OPTION_LOW_PRIORITY_ONCE = 6;
- /** Alert option: low-priority alert - repeat. */
+ /** Alert option: low-priority alert - repeat. @hide */
public static final int ALERT_OPTION_LOW_PRIORITY_REPEAT = 7;
- /** Alert option: medium-priority alert once. */
+ /** Alert option: medium-priority alert once. @hide */
public static final int ALERT_OPTION_MED_PRIORITY_ONCE = 8;
- /** Alert option: medium-priority alert - repeat. */
+ /** Alert option: medium-priority alert - repeat. @hide */
public static final int ALERT_OPTION_MED_PRIORITY_REPEAT = 9;
- /** Alert option: high-priority alert once. */
+ /** Alert option: high-priority alert once. @hide */
public static final int ALERT_OPTION_HIGH_PRIORITY_ONCE = 10;
- /** Alert option: high-priority alert - repeat. */
+ /** Alert option: high-priority alert - repeat. @hide */
public static final int ALERT_OPTION_HIGH_PRIORITY_REPEAT = 11;
/** Service category operation (add/delete/clear). */
@@ -94,9 +145,12 @@
/** Name of service category. */
private final String mCategoryName;
- /** Create a new CdmaSmsCbProgramData object with the specified values. */
- public CdmaSmsCbProgramData(int operation, int category, int language, int maxMessages,
- int alertOption, @NonNull String categoryName) {
+ /**
+ * Create a new CdmaSmsCbProgramData object with the specified values.
+ * @hide
+ */
+ public CdmaSmsCbProgramData(@Operation int operation, @Category int category, int language,
+ int maxMessages, int alertOption, @NonNull String categoryName) {
mOperation = operation;
mCategory = category;
mLanguage = language;
@@ -105,7 +159,10 @@
mCategoryName = categoryName;
}
- /** Create a new CdmaSmsCbProgramData object from a Parcel. */
+ /**
+ * Create a new CdmaSmsCbProgramData object from a Parcel.
+ * @hide
+ */
CdmaSmsCbProgramData(Parcel in) {
mOperation = in.readInt();
mCategory = in.readInt();
@@ -133,23 +190,28 @@
/**
* Returns the service category operation, e.g. {@link #OPERATION_ADD_CATEGORY}.
- * @return one of the {@code OPERATION_*} values
+ *
+ * @return the service category operation
*/
- public int getOperation() {
+ public @Operation int getOperation() {
return mOperation;
}
/**
- * Returns the CDMA service category to modify.
+ * Returns the CDMA service category to modify. See 3GPP2 C.S0015-B section 3.4.3.2 for more
+ * information on the service category. Currently only CMAS service categories 0x1000 through
+ * 0x10FF are supported.
+ *
* @return a 16-bit CDMA service category value
*/
- public int getCategory() {
+ public @Category int getCategory() {
return mCategory;
}
/**
* Returns the CDMA language code for this service category.
* @return one of the language values defined in BearerData.LANGUAGE_*
+ * @hide
*/
public int getLanguage() {
return mLanguage;
@@ -158,6 +220,7 @@
/**
* Returns the maximum number of messages to store for this service category.
* @return the maximum number of messages to store for this service category
+ * @hide
*/
public int getMaxMessages() {
return mMaxMessages;
@@ -166,6 +229,7 @@
/**
* Returns the service category alert option, e.g. {@link #ALERT_OPTION_DEFAULT_ALERT}.
* @return one of the {@code ALERT_OPTION_*} values
+ * @hide
*/
public int getAlertOption() {
return mAlertOption;
@@ -174,6 +238,7 @@
/**
* Returns the service category name, in the language specified by {@link #getLanguage()}.
* @return an optional service category name
+ * @hide
*/
@NonNull
public String getCategoryName() {
@@ -196,7 +261,10 @@
return 0;
}
- /** Creator for unparcelling objects. */
+ /**
+ * Creator for unparcelling objects.
+ */
+ @NonNull
public static final Parcelable.Creator<CdmaSmsCbProgramData>
CREATOR = new Parcelable.Creator<CdmaSmsCbProgramData>() {
@Override
diff --git a/telephony/java/android/telephony/emergency/EmergencyNumber.java b/telephony/java/android/telephony/emergency/EmergencyNumber.java
index 19d0724..1666265 100644
--- a/telephony/java/android/telephony/emergency/EmergencyNumber.java
+++ b/telephony/java/android/telephony/emergency/EmergencyNumber.java
@@ -18,6 +18,7 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.TestApi;
import android.hardware.radio.V1_4.EmergencyNumberSource;
import android.hardware.radio.V1_4.EmergencyServiceCategory;
import android.os.Parcel;
@@ -184,6 +185,7 @@
*
* @hide
*/
+ @TestApi
public static final int EMERGENCY_NUMBER_SOURCE_TEST = 1 << 5;
/** Bit-field which indicates the number is from the modem config. */
public static final int EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG =
diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
index f2f3c2d..b57ae3c 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -90,6 +90,10 @@
void notifyActiveDataSubIdChanged(int activeDataSubId);
void notifyRadioPowerStateChanged(in int phoneId, in int subId, in int state);
void notifyEmergencyNumberList(in int phoneId, in int subId);
+ void notifyOutgoingEmergencyCall(in int phoneId, in int subId,
+ in EmergencyNumber emergencyNumber);
+ void notifyOutgoingEmergencySms(in int phoneId, in int subId,
+ in EmergencyNumber emergencyNumber);
void notifyCallQualityChanged(in CallQuality callQuality, int phoneId, int subId,
int callNetworkType);
void notifyImsDisconnectCause(int subId, in ImsReasonInfo imsReasonInfo);
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java b/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java
index bed2de1..4a49fbf 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java
@@ -17,6 +17,8 @@
package com.android.internal.telephony.cdma.sms;
+import android.telephony.cdma.CdmaSmsCbProgramData;
+
import com.android.internal.telephony.cdma.sms.CdmaSmsSubaddress;
public final class SmsEnvelope {
@@ -55,12 +57,18 @@
//...
// CMAS alert service category assignments, see 3GPP2 C.R1001 table 9.3.3-1
- public static final int SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT = 0x1000;
- public static final int SERVICE_CATEGORY_CMAS_EXTREME_THREAT = 0x1001;
- public static final int SERVICE_CATEGORY_CMAS_SEVERE_THREAT = 0x1002;
- public static final int SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY = 0x1003;
- public static final int SERVICE_CATEGORY_CMAS_TEST_MESSAGE = 0x1004;
- public static final int SERVICE_CATEGORY_CMAS_LAST_RESERVED_VALUE = 0x10ff;
+ public static final int SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT =
+ CdmaSmsCbProgramData.CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT;
+ public static final int SERVICE_CATEGORY_CMAS_EXTREME_THREAT =
+ CdmaSmsCbProgramData.CATEGORY_CMAS_EXTREME_THREAT;
+ public static final int SERVICE_CATEGORY_CMAS_SEVERE_THREAT =
+ CdmaSmsCbProgramData.CATEGORY_CMAS_SEVERE_THREAT;
+ public static final int SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY =
+ CdmaSmsCbProgramData.CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY;
+ public static final int SERVICE_CATEGORY_CMAS_TEST_MESSAGE =
+ CdmaSmsCbProgramData.CATEGORY_CMAS_TEST_MESSAGE;
+ public static final int SERVICE_CATEGORY_CMAS_LAST_RESERVED_VALUE =
+ CdmaSmsCbProgramData.CATEGORY_CMAS_LAST_RESERVED_VALUE;
/**
* Provides the type of a SMS message like point to point, broadcast or acknowledge
diff --git a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
index 730b210..fe1d9d2 100644
--- a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
+++ b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
@@ -92,5 +92,18 @@
}
assertTrue("Did not see framework.jar in " + res, sawFramework);
assertTrue("Did not see services.jar in " + res, sawServices);
+
+
+ // Test the profile contents contain common methods for core-oj that would normally be AOT
+ // compiled.
+ res = mTestDevice.executeShellCommand("profman --dump-classes-and-methods --profile-file="
+ + SYSTEM_SERVER_PROFILE + " --apk=/apex/com.android.art/javalib/core-oj.jar");
+ boolean sawObjectInit = false;
+ for (String line : res.split("\n")) {
+ if (line.contains("Ljava/lang/Object;-><init>()V")) {
+ sawObjectInit = true;
+ }
+ }
+ assertTrue("Did not see Object.<init> in " + res, sawObjectInit);
}
}
diff --git a/tests/net/java/android/net/netlink/InetDiagSocketTest.java b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
index 2adbb06..46e27c1 100644
--- a/tests/net/java/android/net/netlink/InetDiagSocketTest.java
+++ b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
@@ -18,7 +18,6 @@
import static android.net.netlink.StructNlMsgHdr.NLM_F_DUMP;
import static android.net.netlink.StructNlMsgHdr.NLM_F_REQUEST;
-import static android.os.Process.INVALID_UID;
import static android.system.OsConstants.AF_INET;
import static android.system.OsConstants.AF_INET6;
import static android.system.OsConstants.IPPROTO_TCP;
@@ -28,6 +27,7 @@
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -152,9 +152,13 @@
private void checkConnectionOwnerUid(int protocol, InetSocketAddress local,
InetSocketAddress remote, boolean expectSuccess) {
- final int expectedUid = expectSuccess ? Process.myUid() : INVALID_UID;
final int uid = mCm.getConnectionOwnerUid(protocol, local, remote);
- assertEquals(expectedUid, uid);
+
+ if (expectSuccess) {
+ assertEquals(Process.myUid(), uid);
+ } else {
+ assertNotEquals(Process.myUid(), uid);
+ }
}
private int findLikelyFreeUdpPort(UdpConnection conn) throws Exception {
@@ -165,11 +169,11 @@
return localPort;
}
+ /**
+ * Create a test connection for UDP and TCP sockets and verify that this
+ * {protocol, local, remote} socket result in receiving a valid UID.
+ */
public void checkGetConnectionOwnerUid(String to, String from) throws Exception {
- /**
- * For TCP connections, create a test connection and verify that this
- * {protocol, local, remote} socket result in receiving a valid UID.
- */
TcpConnection tcp = new TcpConnection(to, from);
checkConnectionOwnerUid(tcp.protocol, tcp.local, tcp.remote, true);
checkConnectionOwnerUid(IPPROTO_UDP, tcp.local, tcp.remote, false);
@@ -177,20 +181,14 @@
checkConnectionOwnerUid(tcp.protocol, tcp.local, new InetSocketAddress(0), false);
tcp.close();
- /**
- * For UDP connections, either a complete match {protocol, local, remote} or a
- * partial match {protocol, local} should return a valid UID.
- */
UdpConnection udp = new UdpConnection(to,from);
checkConnectionOwnerUid(udp.protocol, udp.local, udp.remote, true);
- checkConnectionOwnerUid(udp.protocol, udp.local, new InetSocketAddress(0), true);
checkConnectionOwnerUid(IPPROTO_TCP, udp.local, udp.remote, false);
checkConnectionOwnerUid(udp.protocol, new InetSocketAddress(findLikelyFreeUdpPort(udp)),
udp.remote, false);
udp.close();
}
- @Ignore
@Test
public void testGetConnectionOwnerUid() throws Exception {
checkGetConnectionOwnerUid("::", null);
@@ -203,6 +201,17 @@
checkGetConnectionOwnerUid("::1", "::1");
}
+ @Ignore("Times out on Marlin/Sailfish")
+ /* Verify fix for b/141603906 */
+ @Test
+ public void testB141603906() throws Exception {
+ final InetSocketAddress src = new InetSocketAddress(0);
+ final InetSocketAddress dst = new InetSocketAddress(0);
+ for (int i = 1; i <= 100000; i++) {
+ mCm.getConnectionOwnerUid(IPPROTO_TCP, src, dst);
+ }
+ }
+
// Hexadecimal representation of InetDiagReqV2 request.
private static final String INET_DIAG_REQ_V2_UDP_INET4_HEX =
// struct nlmsghdr
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index 9e21db7..5bfd647 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -258,13 +258,13 @@
private static final String TAG = "ConnectivityServiceTest";
private static final int TIMEOUT_MS = 500;
- private static final int TEST_LINGER_DELAY_MS = 250;
+ private static final int TEST_LINGER_DELAY_MS = 300;
// Chosen to be less than the linger timeout. This ensures that we can distinguish between a
// LOST callback that arrives immediately and a LOST callback that arrives after the linger
// timeout. For this, our assertions should run fast enough to leave less than
// (mService.mLingerDelayMs - TEST_CALLBACK_TIMEOUT_MS) between the time callbacks are
// supposedly fired, and the time we call expectCallback.
- private static final int TEST_CALLBACK_TIMEOUT_MS = 200;
+ private static final int TEST_CALLBACK_TIMEOUT_MS = 250;
// Chosen to be less than TEST_CALLBACK_TIMEOUT_MS. This ensures that requests have time to
// complete before callbacks are verified.
private static final int TEST_REQUEST_TIMEOUT_MS = 150;
@@ -1466,6 +1466,10 @@
* received. assertNoCallback may be called at any time.
*/
private class TestNetworkCallback extends TestableNetworkCallback {
+ TestNetworkCallback() {
+ super(TEST_CALLBACK_TIMEOUT_MS);
+ }
+
@Override
public void assertNoCallback() {
// TODO: better support this use case in TestableNetworkCallback
diff --git a/tools/aapt2/Main.cpp b/tools/aapt2/Main.cpp
index 7966ba2..8a43bb4 100644
--- a/tools/aapt2/Main.cpp
+++ b/tools/aapt2/Main.cpp
@@ -169,17 +169,12 @@
aapt::text::Printer printer(&fout);
aapt::StdErrDiagnostics diagnostics;
- auto main_command = new aapt::MainCommand(&printer, &diagnostics);
+ aapt::MainCommand main_command(&printer, &diagnostics);
// Add the daemon subcommand here so it cannot be called while executing the daemon
- main_command->AddOptionalSubcommand(
+ main_command.AddOptionalSubcommand(
aapt::util::make_unique<aapt::DaemonCommand>(&fout, &diagnostics));
- return main_command->Execute(args, &std::cerr);
-}
-
-// TODO(b/141312058) stop leaks
-extern "C" const char *__asan_default_options() {
- return "detect_leaks=0";
+ return main_command.Execute(args, &std::cerr);
}
int main(int argc, char** argv) {