Merge "Rename some Vpn fields."
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/system-current.txt b/api/system-current.txt
index dd0df39..b321065 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5168,7 +5168,8 @@
method @NonNull public static java.io.File getOdmDirectory();
method @NonNull public static java.io.File getOemDirectory();
method @NonNull public static java.io.File getProductDirectory();
- method @NonNull public static java.io.File getProductServicesDirectory();
+ method @Deprecated @NonNull public static java.io.File getProductServicesDirectory();
+ method @NonNull public static java.io.File getSystemExtDirectory();
method @NonNull public static java.io.File getVendorDirectory();
}
@@ -7751,6 +7752,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);
diff --git a/api/test-current.txt b/api/test-current.txt
index 077abe0..aeaa258 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -2852,6 +2852,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);
diff --git a/cmds/idmap2/idmap2/Scan.cpp b/cmds/idmap2/idmap2/Scan.cpp
index cfac5f3..0b349e1 100644
--- a/cmds/idmap2/idmap2/Scan.cpp
+++ b/cmds/idmap2/idmap2/Scan.cpp
@@ -103,6 +103,7 @@
{"/oem/", kPolicyOem},
{"/product/", kPolicyProduct},
{"/system/", kPolicySystem},
+ {"/system_ext/", kPolicySystem},
{"/vendor/", kPolicyVendor},
};
diff --git a/cmds/telecom/src/com/android/commands/telecom/Telecom.java b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
index e0f7d86..b37ee74 100644
--- a/cmds/telecom/src/com/android/commands/telecom/Telecom.java
+++ b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
@@ -65,6 +65,14 @@
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";
@@ -193,6 +201,9 @@
case COMMAND_GET_DEFAULT_DIALER:
runGetDefaultDialer();
break;
+ case COMMAND_SET_SYSTEM_DIALER:
+ runSetSystemDialer();
+ break;
case COMMAND_GET_SYSTEM_DIALER:
runGetSystemDialer();
break;
@@ -297,6 +308,12 @@
System.out.println("Success - " + packageName + " set as override default dialer.");
}
+ private void runSetSystemDialer() throws RemoteException {
+ final String packageName = nextArg();
+ mTelecomService.setSystemDialerPackage(packageName.equals("default") ? null : packageName);
+ System.out.println("Success - " + packageName + " set as override system dialer.");
+ }
+
private void runGetDefaultDialer() throws RemoteException {
System.out.println(mTelecomService.getDefaultDialerPackage());
}
diff --git a/core/java/android/app/AppCompatCallbacks.java b/core/java/android/app/AppCompatCallbacks.java
index 08c97eb..19d158d 100644
--- a/core/java/android/app/AppCompatCallbacks.java
+++ b/core/java/android/app/AppCompatCallbacks.java
@@ -18,7 +18,6 @@
import android.compat.Compatibility;
import android.os.Process;
-import android.util.Log;
import android.util.StatsLog;
import com.android.internal.compat.ChangeReporter;
@@ -31,8 +30,6 @@
* @hide
*/
public final class AppCompatCallbacks extends Compatibility.Callbacks {
- private static final String TAG = "Compatibility";
-
private final long[] mDisabledChanges;
private final ChangeReporter mChangeReporter;
@@ -48,7 +45,8 @@
private AppCompatCallbacks(long[] disabledChanges) {
mDisabledChanges = Arrays.copyOf(disabledChanges, disabledChanges.length);
Arrays.sort(mDisabledChanges);
- mChangeReporter = new ChangeReporter();
+ mChangeReporter = new ChangeReporter(
+ StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__SOURCE__APP_PROCESS);
}
protected void reportChange(long changeId) {
@@ -67,10 +65,7 @@
private void reportChange(long changeId, int state) {
int uid = Process.myUid();
- //TODO(b/138374585): Implement rate limiting for the logs.
- Log.d(TAG, ChangeReporter.createLogString(uid, changeId, state));
- mChangeReporter.reportChange(uid, changeId,
- state, /* source */StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__SOURCE__APP_PROCESS);
+ mChangeReporter.reportChange(uid, changeId, state);
}
}
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 9bc5f80..d6b70e0 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -614,10 +614,10 @@
/**
* Value for {@link #privateFlags}: whether this app is pre-installed on the
- * google partition of the system image.
+ * system_ext partition of the system image.
* @hide
*/
- public static final int PRIVATE_FLAG_PRODUCT_SERVICES = 1 << 21;
+ public static final int PRIVATE_FLAG_SYSTEM_EXT = 1 << 21;
/**
* Indicates whether this package requires access to non-SDK APIs.
@@ -713,7 +713,7 @@
PRIVATE_FLAG_USE_EMBEDDED_DEX,
PRIVATE_FLAG_PRIVILEGED,
PRIVATE_FLAG_PRODUCT,
- PRIVATE_FLAG_PRODUCT_SERVICES,
+ PRIVATE_FLAG_SYSTEM_EXT,
PRIVATE_FLAG_PROFILEABLE_BY_SHELL,
PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER,
PRIVATE_FLAG_SIGNED_WITH_PLATFORM_KEY,
@@ -2047,8 +2047,8 @@
}
/** @hide */
- public boolean isProductServices() {
- return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES) != 0;
+ public boolean isSystemExt() {
+ return (privateFlags & ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT) != 0;
}
/** @hide */
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 643cb3e..f15b5d7 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -6897,8 +6897,8 @@
}
/** @hide */
- public boolean isProductServices() {
- return applicationInfo.isProductServices();
+ public boolean isSystemExt() {
+ return applicationInfo.isSystemExt();
}
/** @hide */
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 51896aa..f5426cd 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -1186,7 +1186,7 @@
ArrayList<Partition> partitions = new ArrayList();
String[] names = new String[] {
- "bootimage", "odm", "product", "product_services", Partition.PARTITION_NAME_SYSTEM,
+ "bootimage", "odm", "product", "system_ext", Partition.PARTITION_NAME_SYSTEM,
"vendor"
};
for (String name : names) {
diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java
index 0ee9a11..3462d1f 100644
--- a/core/java/android/os/Environment.java
+++ b/core/java/android/os/Environment.java
@@ -54,7 +54,7 @@
private static final String ENV_ODM_ROOT = "ODM_ROOT";
private static final String ENV_VENDOR_ROOT = "VENDOR_ROOT";
private static final String ENV_PRODUCT_ROOT = "PRODUCT_ROOT";
- private static final String ENV_PRODUCT_SERVICES_ROOT = "PRODUCT_SERVICES_ROOT";
+ private static final String ENV_SYSTEM_EXT_ROOT = "SYSTEM_EXT_ROOT";
/** {@hide} */
public static final String DIR_ANDROID = "Android";
@@ -77,8 +77,8 @@
private static final File DIR_ODM_ROOT = getDirectory(ENV_ODM_ROOT, "/odm");
private static final File DIR_VENDOR_ROOT = getDirectory(ENV_VENDOR_ROOT, "/vendor");
private static final File DIR_PRODUCT_ROOT = getDirectory(ENV_PRODUCT_ROOT, "/product");
- private static final File DIR_PRODUCT_SERVICES_ROOT = getDirectory(ENV_PRODUCT_SERVICES_ROOT,
- "/product_services");
+ private static final File DIR_SYSTEM_EXT_ROOT = getDirectory(ENV_SYSTEM_EXT_ROOT,
+ "/system_ext");
@UnsupportedAppUsage
private static UserEnvironment sCurrentUser;
@@ -222,11 +222,26 @@
* Return root directory of the "product_services" partition holding middleware
* services if any. If present, the partition is mounted read-only.
*
+ * @deprecated This directory is not guaranteed to exist.
+ * Its name is changed to "system_ext" because the partition's purpose is changed.
+ * {@link #getSystemExtDirectory()}
* @hide
*/
@SystemApi
+ @Deprecated
public static @NonNull File getProductServicesDirectory() {
- return DIR_PRODUCT_SERVICES_ROOT;
+ return getDirectory("PRODUCT_SERVICES_ROOT", "/product_services");
+ }
+
+ /**
+ * Return root directory of the "system_ext" partition holding system partition's extension
+ * If present, the partition is mounted read-only.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static @NonNull File getSystemExtDirectory() {
+ return DIR_SYSTEM_EXT_ROOT;
}
/**
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/compat/ChangeReporter.java b/core/java/com/android/internal/compat/ChangeReporter.java
index 1ce071b..8283eb7 100644
--- a/core/java/com/android/internal/compat/ChangeReporter.java
+++ b/core/java/com/android/internal/compat/ChangeReporter.java
@@ -16,14 +16,88 @@
package com.android.internal.compat;
+import android.util.Log;
+import android.util.Slog;
import android.util.StatsLog;
+import com.android.internal.annotations.GuardedBy;
+
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+
/**
* A helper class to report changes to stats log.
*
* @hide
*/
public final class ChangeReporter {
+ private static final String TAG = "CompatibilityChangeReporter";
+ private int mSource;
+
+ private final class ChangeReport {
+ int mUid;
+ long mChangeId;
+ int mState;
+
+ ChangeReport(int uid, long changeId, int state) {
+ mUid = uid;
+ mChangeId = changeId;
+ mState = state;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ChangeReport that = (ChangeReport) o;
+ return mUid == that.mUid
+ && mChangeId == that.mChangeId
+ && mState == that.mState;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mUid, mChangeId, mState);
+ }
+ }
+
+ @GuardedBy("mReportedChanges")
+ private Set<ChangeReport> mReportedChanges = new HashSet<>();
+
+ public ChangeReporter(int source) {
+ mSource = source;
+ }
+
+ /**
+ * Report the change to stats log.
+ *
+ * @param uid affected by the change
+ * @param changeId the reported change id
+ * @param state of the reported change - enabled/disabled/only logged
+ */
+ public void reportChange(int uid, long changeId, int state) {
+ ChangeReport report = new ChangeReport(uid, changeId, state);
+ synchronized (mReportedChanges) {
+ if (!mReportedChanges.contains(report)) {
+ debugLog(uid, changeId, state);
+ StatsLog.write(StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED, uid, changeId,
+ state, mSource);
+ mReportedChanges.add(report);
+ }
+ }
+ }
+
+ private void debugLog(int uid, long changeId, int state) {
+ String message = String.format("Compat change id reported: %d; UID %d; state: %s", changeId,
+ uid, stateToString(state));
+ if (mSource == StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__SOURCE__SYSTEM_SERVER) {
+ Slog.d(TAG, message);
+ } else {
+ Log.d(TAG, message);
+ }
+
+ }
/**
* Transforms StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__STATE enum to a string.
@@ -43,31 +117,4 @@
return "UNKNOWN";
}
}
-
- /**
- * Constructs and returns a string to be logged to logcat when a change is reported.
- *
- * @param uid affected by the change
- * @param changeId the reported change id
- * @param state of the reported change - enabled/disabled/only logged
- * @return string to log
- */
- public static String createLogString(int uid, long changeId, int state) {
- return String.format("Compat change id reported: %d; UID %d; state: %s", changeId, uid,
- stateToString(state));
- }
-
- /**
- * Report the change to stats log.
- *
- * @param uid affected by the change
- * @param changeId the reported change id
- * @param state of the reported change - enabled/disabled/only logged
- * @param source of the logging - app process or system server
- */
- public void reportChange(int uid, long changeId, int state, int source) {
- //TODO(b/138374585): Implement rate limiting for stats log.
- StatsLog.write(StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED, uid, changeId,
- state, source);
- }
}
diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java
index 1de2e72..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;
@@ -192,6 +196,22 @@
}
}
+ /**
+ * Common initialization that (unlike {@link #commonInit()} should happen prior to
+ * the Zygote fork.
+ */
+ 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
protected static final void commonInit() {
if (DEBUG) Slog.d(TAG, "Entered RuntimeInit!");
@@ -324,7 +344,7 @@
@UnsupportedAppUsage
public static final void main(String[] argv) {
- enableDdms();
+ preForkInit();
if (argv.length == 2 && argv[1].equals("application")) {
if (DEBUG) Slog.d(TAG, "RuntimeInit: Starting application");
redirectLogStreams();
@@ -418,7 +438,7 @@
/**
* Enable DDMS.
*/
- static final void enableDdms() {
+ private static void enableDdms() {
// Register handlers for DDM messages.
android.ddm.DdmRegister.registerHandlers();
}
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index ea4b63a..72d2464 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -835,7 +835,7 @@
TimingsTraceLog bootTimingsTraceLog = new TimingsTraceLog(bootTimeTag,
Trace.TRACE_TAG_DALVIK);
bootTimingsTraceLog.traceBegin("ZygoteInit");
- RuntimeInit.enableDdms();
+ RuntimeInit.preForkInit();
boolean startSystemServer = false;
String zygoteSocketName = "zygote";
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java
index 9fc79cb..364278d 100644
--- a/core/java/com/android/server/SystemConfig.java
+++ b/core/java/com/android/server/SystemConfig.java
@@ -194,9 +194,8 @@
final ArrayMap<String, ArraySet<String>> mProductPrivAppPermissions = new ArrayMap<>();
final ArrayMap<String, ArraySet<String>> mProductPrivAppDenyPermissions = new ArrayMap<>();
- final ArrayMap<String, ArraySet<String>> mProductServicesPrivAppPermissions = new ArrayMap<>();
- final ArrayMap<String, ArraySet<String>> mProductServicesPrivAppDenyPermissions =
- new ArrayMap<>();
+ final ArrayMap<String, ArraySet<String>> mSystemExtPrivAppPermissions = new ArrayMap<>();
+ final ArrayMap<String, ArraySet<String>> mSystemExtPrivAppDenyPermissions = new ArrayMap<>();
final ArrayMap<String, ArrayMap<String, Boolean>> mOemPermissions = new ArrayMap<>();
@@ -321,12 +320,20 @@
return mProductPrivAppDenyPermissions.get(packageName);
}
- public ArraySet<String> getProductServicesPrivAppPermissions(String packageName) {
- return mProductServicesPrivAppPermissions.get(packageName);
+ /**
+ * Read from "permission" tags in /system_ext/etc/permissions/*.xml
+ * @return Set of privileged permissions that are explicitly granted.
+ */
+ public ArraySet<String> getSystemExtPrivAppPermissions(String packageName) {
+ return mSystemExtPrivAppPermissions.get(packageName);
}
- public ArraySet<String> getProductServicesPrivAppDenyPermissions(String packageName) {
- return mProductServicesPrivAppDenyPermissions.get(packageName);
+ /**
+ * Read from "deny-permission" tags in /system_ext/etc/permissions/*.xml
+ * @return Set of privileged permissions that are explicitly denied.
+ */
+ public ArraySet<String> getSystemExtPrivAppDenyPermissions(String packageName) {
+ return mSystemExtPrivAppDenyPermissions.get(packageName);
}
public Map<String, Boolean> getOemPermissions(String packageName) {
@@ -398,11 +405,11 @@
readPermissions(Environment.buildPath(
Environment.getProductDirectory(), "etc", "permissions"), ALLOW_ALL);
- // Allow /product_services to customize all system configs
+ // Allow /system_ext to customize all system configs
readPermissions(Environment.buildPath(
- Environment.getProductServicesDirectory(), "etc", "sysconfig"), ALLOW_ALL);
+ Environment.getSystemExtDirectory(), "etc", "sysconfig"), ALLOW_ALL);
readPermissions(Environment.buildPath(
- Environment.getProductServicesDirectory(), "etc", "permissions"), ALLOW_ALL);
+ Environment.getSystemExtDirectory(), "etc", "permissions"), ALLOW_ALL);
}
void readPermissions(File libraryDir, int permissionFlag) {
@@ -848,7 +855,7 @@
} break;
case "privapp-permissions": {
if (allowPrivappPermissions) {
- // privapp permissions from system, vendor, product and product_services
+ // privapp permissions from system, vendor, product and system_ext
// partitions are stored separately. This is to prevent xml files in
// the vendor partition from granting permissions to priv apps in the
// system partition and vice versa.
@@ -858,17 +865,17 @@
Environment.getOdmDirectory().toPath() + "/");
boolean product = permFile.toPath().startsWith(
Environment.getProductDirectory().toPath() + "/");
- boolean productServices = permFile.toPath().startsWith(
- Environment.getProductServicesDirectory().toPath() + "/");
+ boolean systemExt = permFile.toPath().startsWith(
+ Environment.getSystemExtDirectory().toPath() + "/");
if (vendor) {
readPrivAppPermissions(parser, mVendorPrivAppPermissions,
mVendorPrivAppDenyPermissions);
} else if (product) {
readPrivAppPermissions(parser, mProductPrivAppPermissions,
mProductPrivAppDenyPermissions);
- } else if (productServices) {
- readPrivAppPermissions(parser, mProductServicesPrivAppPermissions,
- mProductServicesPrivAppDenyPermissions);
+ } else if (systemExt) {
+ readPrivAppPermissions(parser, mSystemExtPrivAppPermissions,
+ mSystemExtPrivAppDenyPermissions);
} else {
readPrivAppPermissions(parser, mPrivAppPermissions,
mPrivAppDenyPermissions);
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 2b471fe..9342088 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -163,7 +163,7 @@
}
// Generic idmap parameters
- const char* argv[10];
+ const char* argv[11];
int argc = 0;
struct stat st;
@@ -195,8 +195,8 @@
argv[argc++] = AssetManager::PRODUCT_OVERLAY_DIR;
}
- if (stat(AssetManager::PRODUCT_SERVICES_OVERLAY_DIR, &st) == 0) {
- argv[argc++] = AssetManager::PRODUCT_SERVICES_OVERLAY_DIR;
+ if (stat(AssetManager::SYSTEM_EXT_OVERLAY_DIR, &st) == 0) {
+ argv[argc++] = AssetManager::SYSTEM_EXT_OVERLAY_DIR;
}
if (stat(AssetManager::ODM_OVERLAY_DIR, &st) == 0) {
@@ -237,8 +237,8 @@
input_dirs.push_back(AssetManager::PRODUCT_OVERLAY_DIR);
}
- if (stat(AssetManager::PRODUCT_SERVICES_OVERLAY_DIR, &st) == 0) {
- input_dirs.push_back(AssetManager::PRODUCT_SERVICES_OVERLAY_DIR);
+ if (stat(AssetManager::SYSTEM_EXT_OVERLAY_DIR, &st) == 0) {
+ input_dirs.push_back(AssetManager::SYSTEM_EXT_OVERLAY_DIR);
}
if (stat(AssetManager::ODM_OVERLAY_DIR, &st) == 0) {
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index f7318b6..1a81e3d 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -74,7 +74,6 @@
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <bionic/malloc.h>
-#include <cutils/ashmem.h>
#include <cutils/fs.h>
#include <cutils/multiuser.h>
#include <private/android_filesystem_config.h>
@@ -1590,11 +1589,6 @@
if (!SetTaskProfiles(0, {})) {
ZygoteFailure(env, "zygote", nullptr, "Zygote SetTaskProfiles failed");
}
-
- /*
- * ashmem initialization to avoid dlopen overhead
- */
- ashmem_init();
}
/**
diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
index 18448d2..bb57805 100644
--- a/core/jni/fd_utils.cpp
+++ b/core/jni/fd_utils.cpp
@@ -100,8 +100,8 @@
static const char* kVendorOverlaySubdir = "/system/vendor/overlay-subdir/";
static const char* kSystemProductOverlayDir = "/system/product/overlay/";
static const char* kProductOverlayDir = "/product/overlay";
- static const char* kSystemProductServicesOverlayDir = "/system/product_services/overlay/";
- static const char* kProductServicesOverlayDir = "/product_services/overlay";
+ static const char* kSystemSystemExtOverlayDir = "/system/system_ext/overlay/";
+ static const char* kSystemExtOverlayDir = "/system_ext/overlay";
static const char* kSystemOdmOverlayDir = "/system/odm/overlay";
static const char* kOdmOverlayDir = "/odm/overlay";
static const char* kSystemOemOverlayDir = "/system/oem/overlay";
@@ -113,8 +113,8 @@
|| android::base::StartsWith(path, kVendorOverlayDir)
|| android::base::StartsWith(path, kSystemProductOverlayDir)
|| android::base::StartsWith(path, kProductOverlayDir)
- || android::base::StartsWith(path, kSystemProductServicesOverlayDir)
- || android::base::StartsWith(path, kProductServicesOverlayDir)
+ || android::base::StartsWith(path, kSystemSystemExtOverlayDir)
+ || android::base::StartsWith(path, kSystemExtOverlayDir)
|| android::base::StartsWith(path, kSystemOdmOverlayDir)
|| android::base::StartsWith(path, kOdmOverlayDir)
|| android::base::StartsWith(path, kSystemOemOverlayDir)
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/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index 4755cb8..f7c8337 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -74,7 +74,7 @@
const char* AssetManager::IDMAP_BIN = "/system/bin/idmap";
const char* AssetManager::VENDOR_OVERLAY_DIR = "/vendor/overlay";
const char* AssetManager::PRODUCT_OVERLAY_DIR = "/product/overlay";
-const char* AssetManager::PRODUCT_SERVICES_OVERLAY_DIR = "/product_services/overlay";
+const char* AssetManager::SYSTEM_EXT_OVERLAY_DIR = "/system_ext/overlay";
const char* AssetManager::ODM_OVERLAY_DIR = "/odm/overlay";
const char* AssetManager::OEM_OVERLAY_DIR = "/oem/overlay";
const char* AssetManager::OVERLAY_THEME_DIR_PROPERTY = "ro.boot.vendor.overlay.theme";
@@ -575,7 +575,7 @@
mZipSet.setZipResourceTableAsset(ap.path, ass);
}
}
-
+
if (nextEntryIdx == 0 && ass != NULL) {
// If this is the first resource table in the asset
// manager, then we are going to cache it so that we
diff --git a/libs/androidfw/include/androidfw/AssetManager.h b/libs/androidfw/include/androidfw/AssetManager.h
index 66fba26b..ce0985b 100644
--- a/libs/androidfw/include/androidfw/AssetManager.h
+++ b/libs/androidfw/include/androidfw/AssetManager.h
@@ -61,7 +61,7 @@
static const char* IDMAP_BIN;
static const char* VENDOR_OVERLAY_DIR;
static const char* PRODUCT_OVERLAY_DIR;
- static const char* PRODUCT_SERVICES_OVERLAY_DIR;
+ static const char* SYSTEM_EXT_OVERLAY_DIR;
static const char* ODM_OVERLAY_DIR;
static const char* OEM_OVERLAY_DIR;
/*
diff --git a/libs/hwui/pipeline/skia/LayerDrawable.cpp b/libs/hwui/pipeline/skia/LayerDrawable.cpp
index eed1942..b017384 100644
--- a/libs/hwui/pipeline/skia/LayerDrawable.cpp
+++ b/libs/hwui/pipeline/skia/LayerDrawable.cpp
@@ -33,21 +33,51 @@
}
}
-// This is a less-strict matrix.isTranslate() that will still report being translate-only
-// on imperceptibly small scaleX & scaleY values.
-static bool isBasicallyTranslate(const SkMatrix& matrix) {
- if (!matrix.isScaleTranslate()) return false;
- return MathUtils::isOne(matrix.getScaleX()) && MathUtils::isOne(matrix.getScaleY());
+static inline SkScalar isIntegerAligned(SkScalar x) {
+ return fabsf(roundf(x) - x) <= NON_ZERO_EPSILON;
}
-static bool shouldFilter(const SkMatrix& matrix) {
- if (!matrix.isScaleTranslate()) return true;
-
- // We only care about meaningful scale here
- bool noScale = MathUtils::isOne(matrix.getScaleX()) && MathUtils::isOne(matrix.getScaleY());
- bool pixelAligned =
- SkScalarIsInt(matrix.getTranslateX()) && SkScalarIsInt(matrix.getTranslateY());
- return !(noScale && pixelAligned);
+// Disable filtering when there is no scaling in screen coordinates and the corners have the same
+// fraction (for translate) or zero fraction (for any other rect-to-rect transform).
+static bool shouldFilterRect(const SkMatrix& matrix, const SkRect& srcRect, const SkRect& dstRect) {
+ 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())));
+ }
}
bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer,
@@ -114,24 +144,21 @@
skiaDestRect = SkRect::MakeIWH(layerWidth, layerHeight);
}
matrixInv.mapRect(&skiaDestRect);
- // If (matrix is identity or an integer translation) and (src/dst buffers size match),
+ // If (matrix is a rect-to-rect transform)
+ // and (src/dst buffers size match in screen coordinates)
+ // and (src/dst corners align fractionally),
// then use nearest neighbor, otherwise use bilerp sampling.
- // Integer translation is defined as when src rect and dst rect align fractionally.
// Skia TextureOp has the above logic build-in, but not NonAAFillRectOp. TextureOp works
// only for SrcOver blending and without color filter (readback uses Src blending).
- bool isIntegerTranslate =
- isBasicallyTranslate(totalMatrix) &&
- SkScalarFraction(skiaDestRect.fLeft + totalMatrix[SkMatrix::kMTransX]) ==
- SkScalarFraction(skiaSrcRect.fLeft) &&
- SkScalarFraction(skiaDestRect.fTop + totalMatrix[SkMatrix::kMTransY]) ==
- SkScalarFraction(skiaSrcRect.fTop);
- if (layer->getForceFilter() || !isIntegerTranslate) {
+ if (layer->getForceFilter() ||
+ shouldFilterRect(totalMatrix, skiaSrcRect, skiaDestRect)) {
paint.setFilterQuality(kLow_SkFilterQuality);
}
canvas->drawImageRect(layerImage.get(), skiaSrcRect, skiaDestRect, &paint,
SkCanvas::kFast_SrcRectConstraint);
} else {
- if (layer->getForceFilter() || shouldFilter(totalMatrix)) {
+ SkRect imageRect = SkRect::MakeIWH(layerImage->width(), layerImage->height());
+ if (layer->getForceFilter() || shouldFilterRect(totalMatrix, imageRect, imageRect)) {
paint.setFilterQuality(kLow_SkFilterQuality);
}
canvas->drawImage(layerImage.get(), 0, 0, &paint);
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index f326ce8..9898a1c 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -148,7 +148,8 @@
if (surface) {
mNativeSurface = new ReliableSurface{std::move(surface)};
- mNativeSurface->setDequeueTimeout(500_ms);
+ // TODO: Fix error handling & re-shorten timeout
+ mNativeSurface->setDequeueTimeout(4000_ms);
} else {
mNativeSurface = nullptr;
}
diff --git a/mime/Android.bp b/mime/Android.bp
new file mode 100644
index 0000000..0ae94d4
--- /dev/null
+++ b/mime/Android.bp
@@ -0,0 +1,55 @@
+// 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_library {
+ name: "mimemap",
+ visibility: [
+ "//cts/tests/tests/mimemap:__subpackages__",
+ "//frameworks/base:__subpackages__",
+ ],
+
+ srcs: [
+ "java/android/content/type/DefaultMimeMapFactory.java",
+ ],
+
+ java_resources: [
+ ":debian.mime.types",
+ ":android.mime.types",
+ ":vendor.mime.types",
+ ],
+
+ sdk_version: "core_platform",
+}
+
+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/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..56b234f
--- /dev/null
+++ b/mime/java/android/content/type/DefaultMimeMapFactory.java
@@ -0,0 +1,96 @@
+/*
+ * 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.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+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() {
+ MimeMap.Builder builder = MimeMap.builder();
+ parseTypes(builder, true, "/mime.types");
+ parseTypes(builder, true, "/android.mime.types");
+ parseTypes(builder, false, "/vendor.mime.types");
+ return builder.build();
+ }
+
+ private static final Pattern SPLIT_PATTERN = Pattern.compile("\\s+");
+
+ private static void parseTypes(MimeMap.Builder builder, boolean allowOverwrite,
+ String resource) {
+ try (BufferedReader r = new BufferedReader(
+ new InputStreamReader(DefaultMimeMapFactory.class.getResourceAsStream(resource)))) {
+ String line;
+ while ((line = r.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 " + resource, 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/compat/PlatformCompat.java b/services/core/java/com/android/server/compat/PlatformCompat.java
index 33d8dec..8e09d0e 100644
--- a/services/core/java/com/android/server/compat/PlatformCompat.java
+++ b/services/core/java/com/android/server/compat/PlatformCompat.java
@@ -41,7 +41,8 @@
public PlatformCompat(Context context) {
mContext = context;
- mChangeReporter = new ChangeReporter();
+ mChangeReporter = new ChangeReporter(
+ StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__SOURCE__SYSTEM_SERVER);
}
@Override
@@ -96,10 +97,6 @@
private void reportChange(long changeId, ApplicationInfo appInfo, int state) {
int uid = appInfo.uid;
- //TODO(b/138374585): Implement rate limiting for the logs.
- Slog.d(TAG, ChangeReporter.createLogString(uid, changeId, state));
- mChangeReporter.reportChange(uid, changeId,
- state, /* source */
- StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__SOURCE__SYSTEM_SERVER);
+ mChangeReporter.reportChange(uid, changeId, state);
}
}
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/media/MediaSessionRecord.java b/services/core/java/com/android/server/media/MediaSessionRecord.java
index 248351c..0aee850 100644
--- a/services/core/java/com/android/server/media/MediaSessionRecord.java
+++ b/services/core/java/com/android/server/media/MediaSessionRecord.java
@@ -456,6 +456,7 @@
return;
}
mDestroyed = true;
+ mPlaybackState = null;
mHandler.post(MessageHandler.MSG_DESTROYED);
}
}
diff --git a/services/core/java/com/android/server/om/IdmapManager.java b/services/core/java/com/android/server/om/IdmapManager.java
index b604aa8..1f20968 100644
--- a/services/core/java/com/android/server/om/IdmapManager.java
+++ b/services/core/java/com/android/server/om/IdmapManager.java
@@ -237,14 +237,9 @@
return fulfilledPolicies | IIdmap2.POLICY_OEM_PARTITION;
}
- // Check partitions for which there exists no policy so overlays on these partitions will
- // not fulfill the system policy.
- if (ai.isProductServices()) {
- return fulfilledPolicies;
- }
-
+ // System_ext partition (/system_ext) is considered as system
// Check this last since every partition except for data is scanned as system in the PMS.
- if (ai.isSystemApp()) {
+ if (ai.isSystemApp() || ai.isSystemExt()) {
return fulfilledPolicies | IIdmap2.POLICY_SYSTEM_PARTITION;
}
diff --git a/services/core/java/com/android/server/pm/OtaDexoptService.java b/services/core/java/com/android/server/pm/OtaDexoptService.java
index 9094e1b..e5a2e77 100644
--- a/services/core/java/com/android/server/pm/OtaDexoptService.java
+++ b/services/core/java/com/android/server/pm/OtaDexoptService.java
@@ -376,12 +376,12 @@
continue;
}
- // If the path is in /system, /vendor, /product or /product_services, ignore. It will
+ // If the path is in /system, /vendor, /product or /system_ext, ignore. It will
// have been ota-dexopted into /data/ota and moved into the dalvik-cache already.
if (pkg.codePath.startsWith("/system")
|| pkg.codePath.startsWith("/vendor")
|| pkg.codePath.startsWith("/product")
- || pkg.codePath.startsWith("/product_services")) {
+ || pkg.codePath.startsWith("/system_ext")) {
continue;
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 94d262b8..aef7dc7f 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -475,7 +475,7 @@
static final int SCAN_AS_OEM = 1 << 19;
static final int SCAN_AS_VENDOR = 1 << 20;
static final int SCAN_AS_PRODUCT = 1 << 21;
- static final int SCAN_AS_PRODUCT_SERVICES = 1 << 22;
+ static final int SCAN_AS_SYSTEM_EXT = 1 << 22;
static final int SCAN_AS_ODM = 1 << 23;
@IntDef(flag = true, prefix = { "SCAN_" }, value = {
@@ -593,7 +593,7 @@
private static final String PRODUCT_OVERLAY_DIR = "/product/overlay";
- private static final String PRODUCT_SERVICES_OVERLAY_DIR = "/product_services/overlay";
+ private static final String SYSTEM_EXT_OVERLAY_DIR = "/system_ext/overlay";
private static final String ODM_OVERLAY_DIR = "/odm/overlay";
@@ -2604,7 +2604,7 @@
scanFlags = scanFlags | SCAN_FIRST_BOOT_OR_UPGRADE;
}
- // Collect vendor/product/product_services overlay packages. (Do this before scanning
+ // Collect vendor/product/system_ext overlay packages. (Do this before scanning
// any apps.)
// For security and version matching reason, only consider overlay packages if they
// reside in the right directory.
@@ -2622,12 +2622,12 @@
| SCAN_AS_SYSTEM
| SCAN_AS_PRODUCT,
0);
- scanDirTracedLI(new File(PRODUCT_SERVICES_OVERLAY_DIR),
+ scanDirTracedLI(new File(SYSTEM_EXT_OVERLAY_DIR),
mDefParseFlags
| PackageParser.PARSE_IS_SYSTEM_DIR,
scanFlags
| SCAN_AS_SYSTEM
- | SCAN_AS_PRODUCT_SERVICES,
+ | SCAN_AS_SYSTEM_EXT,
0);
scanDirTracedLI(new File(ODM_OVERLAY_DIR),
mDefParseFlags
@@ -2785,37 +2785,37 @@
| SCAN_AS_PRODUCT,
0);
- // Collected privileged /product_services packages.
- File privilegedProductServicesAppDir =
- new File(Environment.getProductServicesDirectory(), "priv-app");
+ // Collected privileged /system_ext packages.
+ File privilegedSystemExtAppDir =
+ new File(Environment.getSystemExtDirectory(), "priv-app");
try {
- privilegedProductServicesAppDir =
- privilegedProductServicesAppDir.getCanonicalFile();
+ privilegedSystemExtAppDir =
+ privilegedSystemExtAppDir.getCanonicalFile();
} catch (IOException e) {
// failed to look up canonical path, continue with original one
}
- scanDirTracedLI(privilegedProductServicesAppDir,
+ scanDirTracedLI(privilegedSystemExtAppDir,
mDefParseFlags
| PackageParser.PARSE_IS_SYSTEM_DIR,
scanFlags
| SCAN_AS_SYSTEM
- | SCAN_AS_PRODUCT_SERVICES
+ | SCAN_AS_SYSTEM_EXT
| SCAN_AS_PRIVILEGED,
0);
- // Collect ordinary /product_services packages.
- File productServicesAppDir = new File(Environment.getProductServicesDirectory(), "app");
+ // Collect ordinary /system_ext packages.
+ File systemExtAppDir = new File(Environment.getSystemExtDirectory(), "app");
try {
- productServicesAppDir = productServicesAppDir.getCanonicalFile();
+ systemExtAppDir = systemExtAppDir.getCanonicalFile();
} catch (IOException e) {
// failed to look up canonical path, continue with original one
}
- scanDirTracedLI(productServicesAppDir,
+ scanDirTracedLI(systemExtAppDir,
mDefParseFlags
| PackageParser.PARSE_IS_SYSTEM_DIR,
scanFlags
| SCAN_AS_SYSTEM
- | SCAN_AS_PRODUCT_SERVICES,
+ | SCAN_AS_SYSTEM_EXT,
0);
// Prune any system packages that no longer exist.
@@ -3045,23 +3045,23 @@
scanFlags
| SCAN_AS_SYSTEM
| SCAN_AS_PRODUCT;
- } else if (FileUtils.contains(privilegedProductServicesAppDir, scanFile)) {
+ } else if (FileUtils.contains(privilegedSystemExtAppDir, scanFile)) {
reparseFlags =
mDefParseFlags |
PackageParser.PARSE_IS_SYSTEM_DIR;
rescanFlags =
scanFlags
| SCAN_AS_SYSTEM
- | SCAN_AS_PRODUCT_SERVICES
+ | SCAN_AS_SYSTEM_EXT
| SCAN_AS_PRIVILEGED;
- } else if (FileUtils.contains(productServicesAppDir, scanFile)) {
+ } else if (FileUtils.contains(systemExtAppDir, scanFile)) {
reparseFlags =
mDefParseFlags |
PackageParser.PARSE_IS_SYSTEM_DIR;
rescanFlags =
scanFlags
| SCAN_AS_SYSTEM
- | SCAN_AS_PRODUCT_SERVICES;
+ | SCAN_AS_SYSTEM_EXT;
} else {
Slog.e(TAG, "Ignoring unexpected fallback path " + scanFile);
continue;
@@ -10849,7 +10849,7 @@
* <li>{@link #SCAN_AS_OEM}</li>
* <li>{@link #SCAN_AS_VENDOR}</li>
* <li>{@link #SCAN_AS_PRODUCT}</li>
- * <li>{@link #SCAN_AS_PRODUCT_SERVICES}</li>
+ * <li>{@link #SCAN_AS_SYSTEM_EXT}</li>
* <li>{@link #SCAN_AS_INSTANT_APP}</li>
* <li>{@link #SCAN_AS_VIRTUAL_PRELOAD}</li>
* <li>{@link #SCAN_AS_ODM}</li>
@@ -10886,8 +10886,8 @@
scanFlags |= SCAN_AS_PRODUCT;
}
if ((systemPkgSetting.pkgPrivateFlags
- & ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES) != 0) {
- scanFlags |= SCAN_AS_PRODUCT_SERVICES;
+ & ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT) != 0) {
+ scanFlags |= SCAN_AS_SYSTEM_EXT;
}
if ((systemPkgSetting.pkgPrivateFlags
& ApplicationInfo.PRIVATE_FLAG_ODM) != 0) {
@@ -11669,8 +11669,8 @@
pkg.applicationInfo.privateFlags |= ApplicationInfo.PRIVATE_FLAG_PRODUCT;
}
- if ((scanFlags & SCAN_AS_PRODUCT_SERVICES) != 0) {
- pkg.applicationInfo.privateFlags |= ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES;
+ if ((scanFlags & SCAN_AS_SYSTEM_EXT) != 0) {
+ pkg.applicationInfo.privateFlags |= ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT;
}
if ((scanFlags & SCAN_AS_ODM) != 0) {
@@ -12634,8 +12634,8 @@
codeRoot = Environment.getOdmDirectory();
} else if (FileUtils.contains(Environment.getProductDirectory(), codePath)) {
codeRoot = Environment.getProductDirectory();
- } else if (FileUtils.contains(Environment.getProductServicesDirectory(), codePath)) {
- codeRoot = Environment.getProductServicesDirectory();
+ } else if (FileUtils.contains(Environment.getSystemExtDirectory(), codePath)) {
+ codeRoot = Environment.getSystemExtDirectory();
} else if (FileUtils.contains(Environment.getOdmDirectory(), codePath)) {
codeRoot = Environment.getOdmDirectory();
} else {
@@ -18192,9 +18192,9 @@
return (pkg.applicationInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT) != 0;
}
- private static boolean isProductServicesApp(PackageParser.Package pkg) {
+ private static boolean isSystemExtApp(PackageParser.Package pkg) {
return (pkg.applicationInfo.privateFlags
- & ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES) != 0;
+ & ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT) != 0;
}
private static boolean isOdmApp(PackageParser.Package pkg) {
@@ -18960,13 +18960,13 @@
final File privilegedVendorAppDir = new File(Environment.getVendorDirectory(), "priv-app");
final File privilegedOdmAppDir = new File(Environment.getOdmDirectory(), "priv-app");
final File privilegedProductAppDir = new File(Environment.getProductDirectory(), "priv-app");
- final File privilegedProductServicesAppDir =
- new File(Environment.getProductServicesDirectory(), "priv-app");
+ final File privilegedSystemExtAppDir =
+ new File(Environment.getSystemExtDirectory(), "priv-app");
return path.startsWith(privilegedAppDir.getCanonicalPath() + "/")
|| path.startsWith(privilegedVendorAppDir.getCanonicalPath() + "/")
|| path.startsWith(privilegedOdmAppDir.getCanonicalPath() + "/")
|| path.startsWith(privilegedProductAppDir.getCanonicalPath() + "/")
- || path.startsWith(privilegedProductServicesAppDir.getCanonicalPath() + "/");
+ || path.startsWith(privilegedSystemExtAppDir.getCanonicalPath() + "/");
} catch (IOException e) {
Slog.e(TAG, "Unable to access code path " + path);
}
@@ -19001,10 +19001,10 @@
return false;
}
- static boolean locationIsProductServices(String path) {
+ static boolean locationIsSystemExt(String path) {
try {
return path.startsWith(
- Environment.getProductServicesDirectory().getCanonicalPath() + "/");
+ Environment.getSystemExtDirectory().getCanonicalPath() + "/");
} catch (IOException e) {
Slog.e(TAG, "Unable to access code path " + path);
}
@@ -19137,8 +19137,8 @@
if (locationIsProduct(codePathString)) {
scanFlags |= SCAN_AS_PRODUCT;
}
- if (locationIsProductServices(codePathString)) {
- scanFlags |= SCAN_AS_PRODUCT_SERVICES;
+ if (locationIsSystemExt(codePathString)) {
+ scanFlags |= SCAN_AS_SYSTEM_EXT;
}
if (locationIsOdm(codePathString)) {
scanFlags |= SCAN_AS_ODM;
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
index 81de8e26..49af15f 100644
--- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
+++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
@@ -1997,10 +1997,10 @@
}
}
- private boolean isProductServicesApp(String pkg) {
+ private boolean isSystemExtApp(String pkg) {
try {
final PackageInfo info = mInterface.getPackageInfo(pkg, 0, UserHandle.USER_SYSTEM);
- return info != null && info.applicationInfo.isProductServices();
+ return info != null && info.applicationInfo.isSystemExt();
} catch (RemoteException e) {
return false;
}
@@ -2018,9 +2018,9 @@
privAppPermissions = SystemConfig.getInstance().getVendorPrivAppPermissions(pkg);
} else if (isProductApp(pkg)) {
privAppPermissions = SystemConfig.getInstance().getProductPrivAppPermissions(pkg);
- } else if (isProductServicesApp(pkg)) {
+ } else if (isSystemExtApp(pkg)) {
privAppPermissions = SystemConfig.getInstance()
- .getProductServicesPrivAppPermissions(pkg);
+ .getSystemExtPrivAppPermissions(pkg);
} else {
privAppPermissions = SystemConfig.getInstance().getPrivAppPermissions(pkg);
}
@@ -2042,9 +2042,9 @@
privAppPermissions = SystemConfig.getInstance().getVendorPrivAppDenyPermissions(pkg);
} else if (isProductApp(pkg)) {
privAppPermissions = SystemConfig.getInstance().getProductPrivAppDenyPermissions(pkg);
- } else if (isProductServicesApp(pkg)) {
+ } else if (isSystemExtApp(pkg)) {
privAppPermissions = SystemConfig.getInstance()
- .getProductServicesPrivAppDenyPermissions(pkg);
+ .getSystemExtPrivAppDenyPermissions(pkg);
} else {
privAppPermissions = SystemConfig.getInstance().getPrivAppDenyPermissions(pkg);
}
diff --git a/services/core/java/com/android/server/pm/PackageSetting.java b/services/core/java/com/android/server/pm/PackageSetting.java
index e859893..4ea8a30 100644
--- a/services/core/java/com/android/server/pm/PackageSetting.java
+++ b/services/core/java/com/android/server/pm/PackageSetting.java
@@ -148,8 +148,8 @@
return (pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT) != 0;
}
- public boolean isProductServices() {
- return (pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES) != 0;
+ public boolean isSystemExt() {
+ return (pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT) != 0;
}
public boolean isOdm() {
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/core/java/com/android/server/pm/SettingBase.java b/services/core/java/com/android/server/pm/SettingBase.java
index a24818f..ec9746d 100644
--- a/services/core/java/com/android/server/pm/SettingBase.java
+++ b/services/core/java/com/android/server/pm/SettingBase.java
@@ -63,7 +63,7 @@
| ApplicationInfo.PRIVATE_FLAG_OEM
| ApplicationInfo.PRIVATE_FLAG_VENDOR
| ApplicationInfo.PRIVATE_FLAG_PRODUCT
- | ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES
+ | ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT
| ApplicationInfo.PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER
| ApplicationInfo.PRIVATE_FLAG_ODM);
}
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 11a8f4b..3bc2236 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -774,7 +774,7 @@
| ApplicationInfo.PRIVATE_FLAG_OEM
| ApplicationInfo.PRIVATE_FLAG_VENDOR
| ApplicationInfo.PRIVATE_FLAG_PRODUCT
- | ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES
+ | ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT
| ApplicationInfo.PRIVATE_FLAG_ODM);
pkgSetting.pkgFlags |= pkgFlags & ApplicationInfo.FLAG_SYSTEM;
pkgSetting.pkgPrivateFlags |=
@@ -786,7 +786,7 @@
pkgSetting.pkgPrivateFlags |=
pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT;
pkgSetting.pkgPrivateFlags |=
- pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES;
+ pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT;
pkgSetting.pkgPrivateFlags |=
pkgPrivateFlags & ApplicationInfo.PRIVATE_FLAG_ODM;
pkgSetting.primaryCpuAbiString = primaryCpuAbi;
@@ -4413,7 +4413,7 @@
ApplicationInfo.PRIVATE_FLAG_STATIC_SHARED_LIBRARY, "STATIC_SHARED_LIBRARY",
ApplicationInfo.PRIVATE_FLAG_VENDOR, "VENDOR",
ApplicationInfo.PRIVATE_FLAG_PRODUCT, "PRODUCT",
- ApplicationInfo.PRIVATE_FLAG_PRODUCT_SERVICES, "PRODUCT_SERVICES",
+ ApplicationInfo.PRIVATE_FLAG_SYSTEM_EXT, "SYSTEM_EXT",
ApplicationInfo.PRIVATE_FLAG_VIRTUAL_PRELOAD, "VIRTUAL_PRELOAD",
ApplicationInfo.PRIVATE_FLAG_ODM, "ODM",
};
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index 4550446..f762985 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -1402,8 +1402,7 @@
if (dir.isDirectory() && dir.canRead()) {
Collections.addAll(ret, dir.listFiles());
}
- dir = new File(Environment.getProductServicesDirectory(),
- "etc/default-permissions");
+ dir = new File(Environment.getSystemExtDirectory(), "etc/default-permissions");
if (dir.isDirectory() && dir.canRead()) {
Collections.addAll(ret, dir.listFiles());
}
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index 8884821..7b25f6d 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -1642,9 +1642,9 @@
} else if (pkg.isProduct()) {
wlPermissions =
SystemConfig.getInstance().getProductPrivAppPermissions(pkg.packageName);
- } else if (pkg.isProductServices()) {
+ } else if (pkg.isSystemExt()) {
wlPermissions =
- SystemConfig.getInstance().getProductServicesPrivAppPermissions(
+ SystemConfig.getInstance().getSystemExtPrivAppPermissions(
pkg.packageName);
} else {
wlPermissions = SystemConfig.getInstance().getPrivAppPermissions(pkg.packageName);
@@ -1678,9 +1678,9 @@
} else if (pkg.isProduct()) {
deniedPermissions = SystemConfig.getInstance()
.getProductPrivAppDenyPermissions(pkg.packageName);
- } else if (pkg.isProductServices()) {
+ } else if (pkg.isSystemExt()) {
deniedPermissions = SystemConfig.getInstance()
- .getProductServicesPrivAppDenyPermissions(pkg.packageName);
+ .getSystemExtPrivAppDenyPermissions(pkg.packageName);
} else {
deniedPermissions = SystemConfig.getInstance()
.getPrivAppDenyPermissions(pkg.packageName);
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/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java
index 95ec3d9..fc7cfec 100644
--- a/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java
@@ -115,7 +115,7 @@
@Test
public void testPartitions() throws Exception {
- String[] partitions = { "system", "vendor", "odm", "oem", "product", "product_services" };
+ String[] partitions = { "system", "vendor", "odm", "oem", "product", "system_ext" };
String[] appdir = { "app", "priv-app" };
for (int i = 0; i < partitions.length; i++) {
for (int j = 0; j < appdir.length; j++) {
@@ -128,7 +128,7 @@
Assert.assertEquals(i == 1 || i == 2, PackageManagerService.locationIsVendor(path));
Assert.assertEquals(i == 3, PackageManagerService.locationIsOem(path));
Assert.assertEquals(i == 4, PackageManagerService.locationIsProduct(path));
- Assert.assertEquals(i == 5, PackageManagerService.locationIsProductServices(path));
+ Assert.assertEquals(i == 5, PackageManagerService.locationIsSystemExt(path));
}
}
}
diff --git a/telecomm/java/android/telecom/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java
index 0e0406d..e4f8d11 100644
--- a/telecomm/java/android/telecom/CallScreeningService.java
+++ b/telecomm/java/android/telecom/CallScreeningService.java
@@ -16,7 +16,6 @@
package android.telecom;
-import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SdkConstant;
import android.app.Service;
@@ -33,9 +32,6 @@
import com.android.internal.telecom.ICallScreeningAdapter;
import com.android.internal.telecom.ICallScreeningService;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
/**
* This service can be implemented by the default dialer (see
* {@link TelecomManager#getDefaultDialerPackage()}) or a third party app to allow or disallow
@@ -75,7 +71,7 @@
*
* public void requestRole() {
* RoleManager roleManager = (RoleManager) getSystemService(ROLE_SERVICE);
- * Intent intent = roleManager.createRequestRoleIntent("android.app.role.CALL_SCREENING");
+ * Intent intent = roleManager.createRequestRoleIntent(RoleManager.ROLE_CALL_SCREENING);
* startActivityForResult(intent, REQUEST_ID);
* }
*
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 4fcda4d..7047498 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -302,6 +302,11 @@
void setTestAutoModeApp(String packageName);
/**
+ * @see TelecomServiceImpl#setSystemDialerPackage
+ */
+ void setSystemDialerPackage(in String packageName);
+
+ /**
* @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..1de5ed4 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}.
*/
@@ -3249,6 +3261,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);
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index fe882ea..2c4d59d1 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/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/tests/FlickerTests/AndroidManifest.xml b/tests/FlickerTests/AndroidManifest.xml
index 9b73abf..91fb7c1 100644
--- a/tests/FlickerTests/AndroidManifest.xml
+++ b/tests/FlickerTests/AndroidManifest.xml
@@ -21,6 +21,8 @@
<!-- Read and write traces from external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+ <!-- Write secure settings -->
+ <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<!-- Capture screen contents -->
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" />
<!-- Enable / Disable tracing !-->
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToAppTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToAppTest.java
new file mode 100644
index 0000000..022f798
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToAppTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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 com.android.server.wm.flicker;
+
+import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToApp;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.LargeTest;
+
+import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper;
+
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
+
+/**
+ * Test IME window closing back to app window transitions.
+ * To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest}
+ */
+@LargeTest
+@RunWith(Parameterized.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CloseImeAutoOpenWindowToAppTest extends CloseImeWindowToAppTest {
+
+ public CloseImeAutoOpenWindowToAppTest(String beginRotationName, int beginRotation) {
+ super(beginRotationName, beginRotation);
+
+ mTestApp = new ImeAppAutoFocusHelper(InstrumentationRegistry.getInstrumentation());
+ }
+
+ @Before
+ public void runTransition() {
+ run(editTextLoseFocusToApp((ImeAppAutoFocusHelper) mTestApp, mUiDevice, mBeginRotation)
+ .includeJankyRuns().build());
+ }
+
+ @FlakyTest(bugId = 141458352)
+ @Ignore("Waiting bug feedback")
+ @Test
+ public void checkVisibility_imeLayerBecomesInvisible() {
+ super.checkVisibility_imeLayerBecomesInvisible();
+ }
+
+ @FlakyTest(bugId = 141458352)
+ @Ignore("Waiting bug feedback")
+ @Test
+ public void checkVisibility_imeAppLayerIsAlwaysVisible() {
+ super.checkVisibility_imeAppLayerIsAlwaysVisible();
+ }
+
+ @FlakyTest(bugId = 141458352)
+ @Ignore("Waiting bug feedback")
+ @Test
+ public void checkVisibility_imeAppWindowIsAlwaysVisible() {
+ super.checkVisibility_imeAppWindowIsAlwaysVisible();
+ }
+
+}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToHomeTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToHomeTest.java
new file mode 100644
index 0000000..d6f994b
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToHomeTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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 com.android.server.wm.flicker;
+
+import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToHome;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.LargeTest;
+
+import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper;
+
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
+
+/**
+ * Test IME window closing back to app window transitions.
+ * To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest}
+ */
+@LargeTest
+@RunWith(Parameterized.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CloseImeAutoOpenWindowToHomeTest extends CloseImeWindowToHomeTest {
+
+ public CloseImeAutoOpenWindowToHomeTest(String beginRotationName, int beginRotation) {
+ super(beginRotationName, beginRotation);
+
+ mTestApp = new ImeAppAutoFocusHelper(InstrumentationRegistry.getInstrumentation());
+ }
+
+ @Before
+ public void runTransition() {
+ run(editTextLoseFocusToHome((ImeAppAutoFocusHelper) mTestApp, mUiDevice, mBeginRotation)
+ .includeJankyRuns().build());
+ }
+
+ @FlakyTest(bugId = 141458352)
+ @Ignore("Waiting bug feedback")
+ @Test
+ public void checkVisibility_imeWindowBecomesInvisible() {
+ super.checkVisibility_imeWindowBecomesInvisible();
+ }
+
+ @FlakyTest(bugId = 141458352)
+ @Ignore("Waiting bug feedback")
+ @Test
+ public void checkVisibility_imeLayerBecomesInvisible() {
+ super.checkVisibility_imeLayerBecomesInvisible();
+ }
+}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java
index 9deb977..28da3af 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java
@@ -17,37 +17,39 @@
package com.android.server.wm.flicker;
import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToApp;
-import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
-
-import android.platform.helpers.IAppHelper;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.LargeTest;
-import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.wm.flicker.helpers.ImeAppHelper;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
/**
* Test IME window closing back to app window transitions.
* To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest}
*/
@LargeTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class CloseImeWindowToAppTest extends FlickerTestBase {
+public class CloseImeWindowToAppTest extends NonRotationTestBase {
- private static final String IME_WINDOW_TITLE = "InputMethod";
- private IAppHelper mImeTestApp = new StandardAppHelper(
- InstrumentationRegistry.getInstrumentation(),
- "com.android.server.wm.flicker.testapp", "ImeApp");
+ static final String IME_WINDOW_TITLE = "InputMethod";
+
+ public CloseImeWindowToAppTest(String beginRotationName, int beginRotation) {
+ super(beginRotationName, beginRotation);
+
+ mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
+ }
@Before
public void runTransition() {
- super.runTransition(editTextLoseFocusToApp(mUiDevice)
+ run(editTextLoseFocusToApp((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation)
.includeJankyRuns().build());
}
@@ -63,20 +65,14 @@
@Test
public void checkVisibility_imeAppLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
- .showsLayer(mImeTestApp.getPackage())
+ .showsLayer(mTestApp.getPackage())
.forAllEntries());
}
@Test
public void checkVisibility_imeAppWindowIsAlwaysVisible() {
checkResults(result -> WmTraceSubject.assertThat(result)
- .showsAppWindowOnTop(mImeTestApp.getPackage())
+ .showsAppWindowOnTop(mTestApp.getPackage())
.forAllEntries());
}
-
- @Test
- public void checkCoveredRegion_noUncoveredRegions() {
- checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
- getDisplayBounds()).forAllEntries());
- }
}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java
index cce5a2a..fc6719e 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java
@@ -17,37 +17,39 @@
package com.android.server.wm.flicker;
import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToHome;
-import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
-
-import android.platform.helpers.IAppHelper;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.LargeTest;
-import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.wm.flicker.helpers.ImeAppHelper;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
/**
* Test IME window closing to home transitions.
* To run this test: {@code atest FlickerTests:CloseImeWindowToHomeTest}
*/
@LargeTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class CloseImeWindowToHomeTest extends FlickerTestBase {
+public class CloseImeWindowToHomeTest extends NonRotationTestBase {
- private static final String IME_WINDOW_TITLE = "InputMethod";
- private IAppHelper mImeTestApp = new StandardAppHelper(
- InstrumentationRegistry.getInstrumentation(),
- "com.android.server.wm.flicker.testapp", "ImeApp");
+ static final String IME_WINDOW_TITLE = "InputMethod";
+
+ public CloseImeWindowToHomeTest(String beginRotationName, int beginRotation) {
+ super(beginRotationName, beginRotation);
+
+ mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
+ }
@Before
public void runTransition() {
- super.runTransition(editTextLoseFocusToHome(mUiDevice)
+ run(editTextLoseFocusToHome((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation)
.includeJankyRuns().build());
}
@@ -72,24 +74,18 @@
@Test
public void checkVisibility_imeAppLayerBecomesInvisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
- .showsLayer(mImeTestApp.getPackage())
+ .showsLayer(mTestApp.getPackage())
.then()
- .hidesLayer(mImeTestApp.getPackage())
+ .hidesLayer(mTestApp.getPackage())
.forAllEntries());
}
@Test
public void checkVisibility_imeAppWindowBecomesInvisible() {
checkResults(result -> WmTraceSubject.assertThat(result)
- .showsAppWindowOnTop(mImeTestApp.getPackage())
+ .showsAppWindowOnTop(mTestApp.getPackage())
.then()
- .hidesAppWindowOnTop(mImeTestApp.getPackage())
+ .hidesAppWindowOnTop(mTestApp.getPackage())
.forAllEntries());
}
-
- @Test
- public void checkCoveredRegion_noUncoveredRegions() {
- checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
- getDisplayBounds()).forAllEntries());
- }
}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
index 1d44ea4..fd31aa5 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
@@ -37,10 +37,10 @@
import android.util.Rational;
import android.view.Surface;
-import androidx.test.InstrumentationRegistry;
-
import com.android.server.wm.flicker.TransitionRunner.TransitionBuilder;
import com.android.server.wm.flicker.helpers.AutomationUtils;
+import com.android.server.wm.flicker.helpers.ImeAppHelper;
+import com.android.server.wm.flicker.helpers.PipAppHelper;
/**
* Collection of common transitions which can be used to test different apps or scenarios.
@@ -73,26 +73,17 @@
}
}
- private static void clickEditTextWidget(UiDevice device, IAppHelper testApp) {
- UiObject2 editText = device.findObject(By.res(testApp.getPackage(), "plain_text_input"));
- editText.click();
- sleep(500);
- }
-
- private static void clickEnterPipButton(UiDevice device, IAppHelper testApp) {
- UiObject2 enterPipButton = device.findObject(By.res(testApp.getPackage(), "enter_pip"));
- enterPipButton.click();
- sleep(500);
- }
-
static TransitionBuilder openAppWarm(IAppHelper testApp, UiDevice
- device) {
+ device, int beginRotation) {
return TransitionRunner.newBuilder()
- .withTag("OpenAppWarm_" + testApp.getLauncherName())
+ .withTag("OpenAppWarm_" + testApp.getLauncherName()
+ + rotationToString(beginRotation))
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
+ .runBeforeAll(() -> setRotation(device, beginRotation))
.runBeforeAll(testApp::open)
.runBefore(device::pressHome)
.runBefore(device::waitForIdle)
+ .runBefore(() -> setRotation(device, beginRotation))
.run(testApp::open)
.runAfterAll(testApp::exit)
.runAfterAll(AutomationUtils::setDefaultWait)
@@ -127,16 +118,19 @@
.repeat(ITERATIONS);
}
- static TransitionBuilder getOpenAppCold(IAppHelper testApp,
- UiDevice device) {
+ static TransitionBuilder openAppCold(IAppHelper testApp,
+ UiDevice device, int beginRotation) {
return TransitionRunner.newBuilder()
- .withTag("OpenAppCold_" + testApp.getLauncherName())
+ .withTag("OpenAppCold_" + testApp.getLauncherName()
+ + rotationToString(beginRotation))
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBefore(device::pressHome)
+ .runBeforeAll(() -> setRotation(device, beginRotation))
.runBefore(testApp::exit)
.runBefore(device::waitForIdle)
.run(testApp::open)
.runAfterAll(testApp::exit)
+ .runAfterAll(() -> setRotation(device, Surface.ROTATION_0))
.repeat(ITERATIONS);
}
@@ -201,28 +195,31 @@
.repeat(ITERATIONS);
}
- static TransitionBuilder editTextSetFocus(UiDevice device) {
- IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
- "com.android.server.wm.flicker.testapp", "ImeApp");
+ static TransitionBuilder editTextSetFocus(ImeAppHelper testApp, UiDevice device,
+ int beginRotation) {
return TransitionRunner.newBuilder()
- .withTag("editTextSetFocus_" + testApp.getLauncherName())
+ .withTag("editTextSetFocus_" + testApp.getLauncherName()
+ + rotationToString(beginRotation))
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBefore(device::pressHome)
+ .runBefore(() -> setRotation(device, beginRotation))
.runBefore(testApp::open)
- .run(() -> clickEditTextWidget(device, testApp))
+ .run(() -> testApp.clickEditTextWidget(device))
.runAfterAll(testApp::exit)
.repeat(ITERATIONS);
}
- static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, IAppHelper testAppBottom,
- UiDevice device, Rational startRatio, Rational stopRatio) {
+ static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, ImeAppHelper testAppBottom,
+ UiDevice device, int beginRotation, Rational startRatio, Rational stopRatio) {
String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_"
+ testAppBottom.getLauncherName() + "_"
+ startRatio.toString().replace("/", ":") + "_to_"
- + stopRatio.toString().replace("/", ":");
+ + stopRatio.toString().replace("/", ":") + "_"
+ + rotationToString(beginRotation);
return TransitionRunner.newBuilder()
.withTag(testTag)
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
+ .runBeforeAll(() -> setRotation(device, beginRotation))
.runBeforeAll(() -> clearRecents(device))
.runBefore(testAppBottom::open)
.runBefore(device::pressHome)
@@ -234,6 +231,7 @@
By.res(device.getLauncherPackageName(), "snapshot"));
snapshot.click();
})
+ .runBefore(() -> testAppBottom.clickEditTextWidget(device))
.runBefore(() -> AutomationUtils.resizeSplitScreen(device, startRatio))
.run(() -> AutomationUtils.resizeSplitScreen(device, stopRatio))
.runAfter(() -> exitSplitScreen(device))
@@ -243,74 +241,70 @@
.repeat(ITERATIONS);
}
- static TransitionBuilder editTextLoseFocusToHome(UiDevice device) {
- IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
- "com.android.server.wm.flicker.testapp", "ImeApp");
+ static TransitionBuilder editTextLoseFocusToHome(ImeAppHelper testApp, UiDevice device,
+ int beginRotation) {
return TransitionRunner.newBuilder()
- .withTag("editTextLoseFocusToHome_" + testApp.getLauncherName())
+ .withTag("editTextLoseFocusToHome_" + testApp.getLauncherName()
+ + rotationToString(beginRotation))
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBefore(device::pressHome)
+ .runBefore(() -> setRotation(device, beginRotation))
.runBefore(testApp::open)
- .runBefore(() -> clickEditTextWidget(device, testApp))
+ .runBefore(() -> testApp.clickEditTextWidget(device))
.run(device::pressHome)
.run(device::waitForIdle)
.runAfterAll(testApp::exit)
.repeat(ITERATIONS);
}
- static TransitionBuilder editTextLoseFocusToApp(UiDevice device) {
- IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
- "com.android.server.wm.flicker.testapp", "ImeApp");
+ static TransitionBuilder editTextLoseFocusToApp(ImeAppHelper testApp, UiDevice device,
+ int beginRotation) {
return TransitionRunner.newBuilder()
- .withTag("editTextLoseFocusToApp_" + testApp.getLauncherName())
+ .withTag("editTextLoseFocusToApp_" + testApp.getLauncherName()
+ + rotationToString(beginRotation))
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBefore(device::pressHome)
+ .runBefore(() -> setRotation(device, beginRotation))
.runBefore(testApp::open)
- .runBefore(() -> clickEditTextWidget(device, testApp))
+ .runBefore(() -> testApp.clickEditTextWidget(device))
.run(device::pressBack)
.run(device::waitForIdle)
.runAfterAll(testApp::exit)
.repeat(ITERATIONS);
}
- static TransitionBuilder enterPipMode(UiDevice device) {
- IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
- "com.android.server.wm.flicker.testapp", "PipApp");
+ static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device) {
return TransitionRunner.newBuilder()
.withTag("enterPipMode_" + testApp.getLauncherName())
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBefore(device::pressHome)
.runBefore(testApp::open)
- .run(() -> clickEnterPipButton(device, testApp))
+ .run(() -> testApp.clickEnterPipButton(device))
.runAfter(() -> closePipWindow(device))
.runAfterAll(testApp::exit)
.repeat(ITERATIONS);
}
- static TransitionBuilder exitPipModeToHome(UiDevice device) {
- IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
- "com.android.server.wm.flicker.testapp", "PipApp");
+ static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device) {
return TransitionRunner.newBuilder()
.withTag("exitPipModeToHome_" + testApp.getLauncherName())
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBefore(device::pressHome)
.runBefore(testApp::open)
- .runBefore(() -> clickEnterPipButton(device, testApp))
+ .runBefore(() -> testApp.clickEnterPipButton(device))
.run(() -> closePipWindow(device))
.run(device::waitForIdle)
.runAfterAll(testApp::exit)
.repeat(ITERATIONS);
}
- static TransitionBuilder exitPipModeToApp(UiDevice device) {
- IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
- "com.android.server.wm.flicker.testapp", "PipApp");
+ static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device) {
return TransitionRunner.newBuilder()
.withTag("exitPipModeToApp_" + testApp.getLauncherName())
.runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
.runBefore(device::pressHome)
.runBefore(testApp::open)
- .runBefore(() -> clickEnterPipButton(device, testApp))
+ .runBefore(() -> testApp.clickEnterPipButton(device))
.run(() -> expandPipWindow(device))
.run(device::waitForIdle)
.runAfterAll(testApp::exit)
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
index 9836655..8f0177c 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
@@ -25,6 +25,9 @@
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
+import com.android.server.wm.flicker.helpers.ImeAppHelper;
+import com.android.server.wm.flicker.helpers.PipAppHelper;
+
import org.junit.FixMethodOrder;
import org.junit.Ignore;
import org.junit.Test;
@@ -44,23 +47,25 @@
private UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
/**
- * atest FlickerTest:DebugTests#openAppCold
+ * atest FlickerTests:DebugTest#openAppCold
*/
@Test
public void openAppCold() {
- CommonTransitions.getOpenAppCold(testApp, uiDevice).recordAllRuns().build().run();
+ CommonTransitions.openAppCold(testApp, uiDevice, Surface.ROTATION_0)
+ .recordAllRuns().build().run();
}
/**
- * atest FlickerTest:DebugTests#openAppWarm
+ * atest FlickerTests:DebugTest#openAppWarm
*/
@Test
public void openAppWarm() {
- CommonTransitions.openAppWarm(testApp, uiDevice).recordAllRuns().build().run();
+ CommonTransitions.openAppWarm(testApp, uiDevice, Surface.ROTATION_0)
+ .recordAllRuns().build().run();
}
/**
- * atest FlickerTest:DebugTests#changeOrientationFromNaturalToLeft
+ * atest FlickerTests:DebugTest#changeOrientationFromNaturalToLeft
*/
@Test
public void changeOrientationFromNaturalToLeft() {
@@ -69,7 +74,7 @@
}
/**
- * atest FlickerTest:DebugTests#closeAppWithBackKey
+ * atest FlickerTests:DebugTest#closeAppWithBackKey
*/
@Test
public void closeAppWithBackKey() {
@@ -77,7 +82,7 @@
}
/**
- * atest FlickerTest:DebugTests#closeAppWithHomeKey
+ * atest FlickerTests:DebugTest#closeAppWithHomeKey
*/
@Test
public void closeAppWithHomeKey() {
@@ -85,7 +90,7 @@
}
/**
- * atest FlickerTest:DebugTests#openAppToSplitScreen
+ * atest FlickerTests:DebugTest#openAppToSplitScreen
*/
@Test
public void openAppToSplitScreen() {
@@ -94,7 +99,7 @@
}
/**
- * atest FlickerTest:DebugTests#splitScreenToLauncher
+ * atest FlickerTests:DebugTest#splitScreenToLauncher
*/
@Test
public void splitScreenToLauncher() {
@@ -104,70 +109,80 @@
}
/**
- * atest FlickerTest:DebugTests#resizeSplitScreen
+ * atest FlickerTests:DebugTest#resizeSplitScreen
*/
@Test
public void resizeSplitScreen() {
- IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
- "com.android.server.wm.flicker.testapp", "ImeApp");
- CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, new Rational(1, 3),
- new Rational(2, 3)).includeJankyRuns().recordEachRun().build().run();
+ ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
+ CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, Surface.ROTATION_0,
+ new Rational(1, 3), new Rational(2, 3))
+ .includeJankyRuns().recordEachRun().build().run();
}
// IME tests
/**
- * atest FlickerTest:DebugTests#editTextSetFocus
+ * atest FlickerTests:DebugTest#editTextSetFocus
*/
@Test
public void editTextSetFocus() {
- CommonTransitions.editTextSetFocus(uiDevice).includeJankyRuns().recordEachRun()
+ ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
+ CommonTransitions.editTextSetFocus(testApp, uiDevice, Surface.ROTATION_0)
+ .includeJankyRuns().recordEachRun()
.build().run();
}
/**
- * atest FlickerTest:DebugTests#editTextLoseFocusToHome
+ * atest FlickerTests:DebugTest#editTextLoseFocusToHome
*/
@Test
public void editTextLoseFocusToHome() {
- CommonTransitions.editTextLoseFocusToHome(uiDevice).includeJankyRuns().recordEachRun()
+ ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
+ CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
+ .includeJankyRuns().recordEachRun()
.build().run();
}
/**
- * atest FlickerTest:DebugTests#editTextLoseFocusToApp
+ * atest FlickerTests:DebugTest#editTextLoseFocusToApp
*/
@Test
public void editTextLoseFocusToApp() {
- CommonTransitions.editTextLoseFocusToHome(uiDevice).includeJankyRuns().recordEachRun()
+ ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
+ CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
+ .includeJankyRuns().recordEachRun()
.build().run();
}
// PIP tests
/**
- * atest FlickerTest:DebugTests#enterPipMode
+ * atest FlickerTests:DebugTest#enterPipMode
*/
@Test
public void enterPipMode() {
- CommonTransitions.enterPipMode(uiDevice).includeJankyRuns().recordEachRun().build().run();
- }
-
- /**
- * atest FlickerTest:DebugTests#exitPipModeToHome
- */
- @Test
- public void exitPipModeToHome() {
- CommonTransitions.exitPipModeToHome(uiDevice).includeJankyRuns().recordEachRun()
+ PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
+ CommonTransitions.enterPipMode(testApp, uiDevice).includeJankyRuns().recordEachRun()
.build().run();
}
/**
- * atest FlickerTest:DebugTests#exitPipModeToApp
+ * atest FlickerTests:DebugTest#exitPipModeToHome
+ */
+ @Test
+ public void exitPipModeToHome() {
+ PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
+ CommonTransitions.exitPipModeToHome(testApp, uiDevice).includeJankyRuns().recordEachRun()
+ .build().run();
+ }
+
+ /**
+ * atest FlickerTests:DebugTest#exitPipModeToApp
*/
@Test
public void exitPipModeToApp() {
- CommonTransitions.exitPipModeToApp(uiDevice).includeJankyRuns().recordEachRun()
+ PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
+ CommonTransitions.exitPipModeToApp(testApp, uiDevice).includeJankyRuns().recordEachRun()
.build().run();
}
}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java
index 6e8e0c3..883d59e 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java
@@ -98,7 +98,7 @@
/**
* Runs a transition, returns a cached result if the transition has run before.
*/
- void runTransition(TransitionRunner transition) {
+ void run(TransitionRunner transition) {
if (transitionResults.containsKey(transition.getTestTag())) {
mResults = transitionResults.get(transition.getTestTag());
return;
@@ -111,6 +111,13 @@
}
/**
+ * Runs a transition, returns a cached result if the transition has run before.
+ */
+ void runTransition(TransitionRunner transition) {
+ run(transition);
+ }
+
+ /**
* Goes through a list of transition results and checks assertions on each result.
*/
void checkResults(Consumer<TransitionResult> assertion) {
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/NonRotationTestBase.java b/tests/FlickerTests/src/com/android/server/wm/flicker/NonRotationTestBase.java
new file mode 100644
index 0000000..54941dc
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/NonRotationTestBase.java
@@ -0,0 +1,80 @@
+/*
+ * 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 com.android.server.wm.flicker;
+
+import static android.view.Surface.rotationToString;
+
+import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
+
+import android.graphics.Rect;
+import android.view.Surface;
+
+import androidx.test.filters.FlakyTest;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public abstract class NonRotationTestBase extends FlickerTestBase {
+
+ int mBeginRotation;
+
+ public NonRotationTestBase(String beginRotationName, int beginRotation) {
+ this.mBeginRotation = beginRotation;
+ }
+
+ @Parameters(name = "{0}")
+ public static Collection<Object[]> getParams() {
+ int[] supportedRotations =
+ {Surface.ROTATION_0, Surface.ROTATION_90};
+ Collection<Object[]> params = new ArrayList<>();
+
+ for (int begin : supportedRotations) {
+ params.add(new Object[]{rotationToString(begin), begin});
+ }
+
+ return params;
+ }
+
+ @FlakyTest(bugId = 141361128)
+ @Ignore("Waiting bug feedback")
+ @Test
+ public void checkCoveredRegion_noUncoveredRegions() {
+ Rect displayBounds = getDisplayBounds(mBeginRotation);
+ checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
+ displayBounds).forAllEntries());
+ }
+
+ @FlakyTest(bugId = 141361128)
+ @Ignore("Waiting bug feedback")
+ @Test
+ public void checkVisibility_navBarLayerIsAlwaysVisible() {
+ checkResults(result -> LayersTraceSubject.assertThat(result)
+ .showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
+ }
+
+ @FlakyTest(bugId = 141361128)
+ @Ignore("Waiting bug feedback")
+ @Test
+ public void checkVisibility_statusBarLayerIsAlwaysVisible() {
+ checkResults(result -> LayersTraceSubject.assertThat(result)
+ .showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries());
+ }
+}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java
index 8d99054..efdfaee 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java
@@ -16,14 +16,12 @@
package com.android.server.wm.flicker;
-import static com.android.server.wm.flicker.CommonTransitions.getOpenAppCold;
-import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
+import static com.android.server.wm.flicker.CommonTransitions.openAppCold;
import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest;
-import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.FixMethodOrder;
@@ -31,36 +29,28 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
/**
* Test cold launch app from launcher.
* To run this test: {@code atest FlickerTests:OpenAppColdTest}
*/
@LargeTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class OpenAppColdTest extends FlickerTestBase {
+public class OpenAppColdTest extends NonRotationTestBase {
- public OpenAppColdTest() {
+ public OpenAppColdTest(String beginRotationName, int beginRotation) {
+ super(beginRotationName, beginRotation);
+
this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
"com.android.server.wm.flicker.testapp", "SimpleApp");
}
@Before
public void runTransition() {
- super.runTransition(getOpenAppCold(mTestApp, mUiDevice).build());
- }
-
- @Test
- public void checkVisibility_navBarWindowIsAlwaysVisible() {
- checkResults(result -> assertThat(result)
- .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
- }
-
- @Test
- public void checkVisibility_statusBarWindowIsAlwaysVisible() {
- checkResults(result -> assertThat(result)
- .showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries());
+ run(openAppCold(mTestApp, mUiDevice, mBeginRotation)
+ .includeJankyRuns().build());
}
@Test
@@ -72,6 +62,8 @@
.forAllEntries());
}
+ @FlakyTest(bugId = 140855415)
+ @Ignore("Waiting bug feedback")
@Test
public void checkZOrder_appWindowReplacesLauncherAsTopWindow() {
checkResults(result -> assertThat(result)
@@ -83,26 +75,6 @@
}
@Test
- @FlakyTest(bugId = 141235985)
- @Ignore("Waiting bug feedback")
- public void checkCoveredRegion_noUncoveredRegions() {
- checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
- getDisplayBounds()).forAllEntries());
- }
-
- @Test
- public void checkVisibility_navBarLayerIsAlwaysVisible() {
- checkResults(result -> LayersTraceSubject.assertThat(result)
- .showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
- }
-
- @Test
- public void checkVisibility_statusBarLayerIsAlwaysVisible() {
- checkResults(result -> LayersTraceSubject.assertThat(result)
- .showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries());
- }
-
- @Test
public void checkVisibility_wallpaperLayerBecomesInvisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
.showsLayer("Wallpaper")
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java
index e8702c2..7ce6315 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java
@@ -17,13 +17,11 @@
package com.android.server.wm.flicker;
import static com.android.server.wm.flicker.CommonTransitions.openAppWarm;
-import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest;
-import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.FixMethodOrder;
@@ -31,36 +29,28 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
/**
* Test warm launch app.
* To run this test: {@code atest FlickerTests:OpenAppWarmTest}
*/
@LargeTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class OpenAppWarmTest extends FlickerTestBase {
+public class OpenAppWarmTest extends NonRotationTestBase {
- public OpenAppWarmTest() {
+ public OpenAppWarmTest(String beginRotationName, int beginRotation) {
+ super(beginRotationName, beginRotation);
+
this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
"com.android.server.wm.flicker.testapp", "SimpleApp");
}
@Before
public void runTransition() {
- super.runTransition(openAppWarm(mTestApp, mUiDevice).includeJankyRuns().build());
- }
-
- @Test
- public void checkVisibility_navBarIsAlwaysVisible() {
- checkResults(result -> assertThat(result)
- .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
- }
-
- @Test
- public void checkVisibility_statusBarIsAlwaysVisible() {
- checkResults(result -> assertThat(result)
- .showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries());
+ super.runTransition(openAppWarm(mTestApp, mUiDevice, mBeginRotation)
+ .includeJankyRuns().build());
}
@Test
@@ -72,6 +62,8 @@
.forAllEntries());
}
+ @FlakyTest(bugId = 140855415)
+ @Ignore("Waiting bug feedback")
@Test
public void checkZOrder_appWindowReplacesLauncherAsTopWindow() {
checkResults(result -> assertThat(result)
@@ -82,26 +74,6 @@
.forAllEntries());
}
- @FlakyTest(bugId = 141235985)
- @Ignore("Waiting bug feedback")
- @Test
- public void checkCoveredRegion_noUncoveredRegions() {
- checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
- getDisplayBounds()).forAllEntries());
- }
-
- @Test
- public void checkVisibility_navBarLayerIsAlwaysVisible() {
- checkResults(result -> LayersTraceSubject.assertThat(result)
- .showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
- }
-
- @Test
- public void checkVisibility_statusBarLayerIsAlwaysVisible() {
- checkResults(result -> LayersTraceSubject.assertThat(result)
- .showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries());
- }
-
@Test
public void checkVisibility_wallpaperLayerBecomesInvisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java
index 9f5cfce..91d4a05 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java
@@ -17,31 +17,39 @@
package com.android.server.wm.flicker;
import static com.android.server.wm.flicker.CommonTransitions.editTextSetFocus;
-import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
+import androidx.test.InstrumentationRegistry;
import androidx.test.filters.LargeTest;
-import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.wm.flicker.helpers.ImeAppHelper;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
/**
* Test IME window opening transitions.
* To run this test: {@code atest FlickerTests:OpenImeWindowTest}
*/
@LargeTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class OpenImeWindowTest extends FlickerTestBase {
+public class OpenImeWindowTest extends NonRotationTestBase {
private static final String IME_WINDOW_TITLE = "InputMethod";
+ public OpenImeWindowTest(String beginRotationName, int beginRotation) {
+ super(beginRotationName, beginRotation);
+
+ mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
+ }
+
@Before
public void runTransition() {
- super.runTransition(editTextSetFocus(mUiDevice)
+ run(editTextSetFocus((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation)
.includeJankyRuns().build());
}
@@ -62,10 +70,4 @@
.showsLayer(IME_WINDOW_TITLE)
.forAllEntries());
}
-
- @Test
- public void checkCoveredRegion_noUncoveredRegions() {
- checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
- getDisplayBounds()).forAllEntries());
- }
}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java
index 1031baf..29b6240 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java
@@ -24,13 +24,13 @@
import static com.google.common.truth.Truth.assertThat;
import android.graphics.Rect;
-import android.platform.helpers.IAppHelper;
import android.util.Rational;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest;
-import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.wm.flicker.helpers.ImeAppHelper;
import org.junit.Before;
import org.junit.FixMethodOrder;
@@ -38,57 +38,48 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
/**
* Test split screen resizing window transitions.
* To run this test: {@code atest FlickerTests:ResizeSplitScreenTest}
*/
@LargeTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-@FlakyTest(bugId = 140856143)
+@FlakyTest(bugId = 140854698)
@Ignore("Waiting bug feedback")
-public class ResizeSplitScreenTest extends FlickerTestBase {
+public class ResizeSplitScreenTest extends NonRotationTestBase {
- public ResizeSplitScreenTest() {
+ private static String sSimpleActivity = "SimpleActivity";
+ private static String sImeActivity = "ImeActivity";
+
+ public ResizeSplitScreenTest(String beginRotationName, int beginRotation) {
+ super(beginRotationName, beginRotation);
+
this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
"com.android.server.wm.flicker.testapp", "SimpleApp");
}
@Before
public void runTransition() {
- IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry
- .getInstrumentation(),
- "com.android.server.wm.flicker.testapp", "ImeApp");
- super.runTransition(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, new Rational(1, 3),
- new Rational(2, 3)).includeJankyRuns().build());
- }
-
- @Test
- public void checkVisibility_navBarLayerIsAlwaysVisible() {
- checkResults(result -> LayersTraceSubject.assertThat(result)
- .showsLayer(NAVIGATION_BAR_WINDOW_TITLE)
- .forAllEntries());
- }
-
- @Test
- public void checkVisibility_statusBarLayerIsAlwaysVisible() {
- checkResults(result -> LayersTraceSubject.assertThat(result)
- .showsLayer(STATUS_BAR_WINDOW_TITLE)
- .forAllEntries());
+ ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
+ run(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, mBeginRotation,
+ new Rational(1, 3), new Rational(2, 3))
+ .includeJankyRuns().build());
}
@Test
public void checkVisibility_topAppLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
- .showsLayer("SimpleActivity")
+ .showsLayer(sSimpleActivity)
.forAllEntries());
}
@Test
public void checkVisibility_bottomAppLayerIsAlwaysVisible() {
checkResults(result -> LayersTraceSubject.assertThat(result)
- .showsLayer("ImeActivity")
+ .showsLayer(sImeActivity)
.forAllEntries());
}
@@ -149,11 +140,11 @@
displayBounds.bottom - getNavigationBarHeight());
LayersTraceSubject.assertThat(result)
- .hasVisibleRegion("SimpleActivity", startingTopAppBounds)
+ .hasVisibleRegion(sSimpleActivity, startingTopAppBounds)
.atTheEnd();
LayersTraceSubject.assertThat(result)
- .hasVisibleRegion("ImeActivity", startingBottomAppBounds)
+ .hasVisibleRegion(sImeActivity, startingBottomAppBounds)
.atTheEnd();
});
}
@@ -175,14 +166,14 @@
@Test
public void checkVisibility_topAppWindowIsAlwaysVisible() {
checkResults(result -> WmTraceSubject.assertThat(result)
- .showsAppWindow("SimpleActivity")
+ .showsAppWindow(sSimpleActivity)
.forAllEntries());
}
@Test
public void checkVisibility_bottomAppWindowIsAlwaysVisible() {
checkResults(result -> WmTraceSubject.assertThat(result)
- .showsAppWindow("ImeActivity")
+ .showsAppWindow(sImeActivity)
.forAllEntries());
}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerAppHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerAppHelper.java
new file mode 100644
index 0000000..42977f5
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerAppHelper.java
@@ -0,0 +1,31 @@
+/*
+ * 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 com.android.server.wm.flicker.helpers;
+
+import android.app.Instrumentation;
+
+import com.android.server.wm.flicker.StandardAppHelper;
+
+public abstract class FlickerAppHelper extends StandardAppHelper {
+
+ static int sFindTimeout = 10000;
+ static String sFlickerPackage = "com.android.server.wm.flicker.testapp";
+
+ public FlickerAppHelper(Instrumentation instr, String launcherName) {
+ super(instr, sFlickerPackage, launcherName);
+ }
+}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.java
new file mode 100644
index 0000000..56e1118
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.java
@@ -0,0 +1,31 @@
+/*
+ * 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 com.android.server.wm.flicker.helpers;
+
+import android.app.Instrumentation;
+import android.support.test.uiautomator.UiDevice;
+
+public class ImeAppAutoFocusHelper extends ImeAppHelper {
+
+ public ImeAppAutoFocusHelper(Instrumentation instr) {
+ super(instr, "ImeAppAutoFocus");
+ }
+
+ public void clickEditTextWidget(UiDevice device) {
+ // do nothing (the app is focused automatically)
+ }
+}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.java
new file mode 100644
index 0000000..098fd6d
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.java
@@ -0,0 +1,41 @@
+/*
+ * 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 com.android.server.wm.flicker.helpers;
+
+import static android.os.SystemClock.sleep;
+
+import android.app.Instrumentation;
+import android.support.test.uiautomator.By;
+import android.support.test.uiautomator.UiDevice;
+import android.support.test.uiautomator.UiObject2;
+
+public class ImeAppHelper extends FlickerAppHelper {
+
+ ImeAppHelper(Instrumentation instr, String launcherName) {
+ super(instr, launcherName);
+ }
+
+ public ImeAppHelper(Instrumentation instr) {
+ this(instr, "ImeApp");
+ }
+
+ public void clickEditTextWidget(UiDevice device) {
+ UiObject2 editText = device.findObject(By.res(getPackage(), "plain_text_input"));
+ editText.click();
+ sleep(500);
+ }
+}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java
new file mode 100644
index 0000000..d00e11b
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java
@@ -0,0 +1,43 @@
+/*
+ * 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 com.android.server.wm.flicker.helpers;
+
+import static com.android.server.wm.flicker.helpers.AutomationUtils.getPipWindowSelector;
+
+import android.app.Instrumentation;
+import android.support.test.uiautomator.By;
+import android.support.test.uiautomator.UiDevice;
+import android.support.test.uiautomator.UiObject2;
+import android.support.test.uiautomator.Until;
+
+public class PipAppHelper extends FlickerAppHelper {
+
+ public PipAppHelper(Instrumentation instr) {
+ super(instr, "PipApp");
+ }
+
+ public void clickEnterPipButton(UiDevice device) {
+ UiObject2 enterPipButton = device.findObject(By.res(getPackage(), "enter_pip"));
+ enterPipButton.click();
+ UiObject2 pipWindow = device.wait(Until.findObject(getPipWindowSelector()), sFindTimeout);
+
+ if (pipWindow == null) {
+ throw new RuntimeException("Unable to find PIP window");
+ }
+ }
+
+}
diff --git a/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml b/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml
index b694172..0fe9682 100644
--- a/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml
+++ b/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml
@@ -38,6 +38,15 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
+ <activity android:name=".ImeActivityAutoFocus"
+ android:taskAffinity="com.android.server.wm.flicker.testapp.ImeActivityAutoFocus"
+ android:windowSoftInputMode="stateVisible"
+ android:label="ImeAppAutoFocus">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
<activity android:name=".PipActivity"
android:resizeableActivity="true"
android:supportsPictureInPicture="true"
diff --git a/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_ime.xml b/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_ime.xml
index d5eb023..4708cfd 100644
--- a/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_ime.xml
+++ b/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_ime.xml
@@ -18,6 +18,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:focusableInTouchMode="true"
android:background="@android:color/holo_green_light">
<EditText android:id="@+id/plain_text_input"
android:layout_height="wrap_content"
diff --git a/tests/libs-permissions/product_services/java/com/android/test/libs/product_services/LibsProductServicesTest.java b/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/ImeActivityAutoFocus.java
similarity index 60%
copy from tests/libs-permissions/product_services/java/com/android/test/libs/product_services/LibsProductServicesTest.java
copy to tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/ImeActivityAutoFocus.java
index dcbdae8..05da717 100644
--- a/tests/libs-permissions/product_services/java/com/android/test/libs/product_services/LibsProductServicesTest.java
+++ b/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/ImeActivityAutoFocus.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 The Android Open Source Project
+ * 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.
@@ -14,16 +14,17 @@
* limitations under the License.
*/
-package com.android.test.libs.product_services;
+package com.android.server.wm.flicker.testapp;
-/**
- * Test class for product_services libs.
- */
-public class LibsProductServicesTest {
+import android.widget.EditText;
- /**
- * Dummy method for testing.
- */
- public static void test() {
+public class ImeActivityAutoFocus extends ImeActivity {
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+
+ EditText editTextField = findViewById(R.id.plain_text_input);
+ editTextField.requestFocus();
}
}
diff --git a/tests/libs-permissions/Android.bp b/tests/libs-permissions/Android.bp
index c7c4b10..330bfc9 100644
--- a/tests/libs-permissions/Android.bp
+++ b/tests/libs-permissions/Android.bp
@@ -14,16 +14,16 @@
}
java_library {
- name: "com.android.test.libs.product_services",
+ name: "com.android.test.libs.system_ext",
installable: true,
- product_services_specific: true,
- srcs: ["product_services/java/**/*.java"],
- required: ["com.android.test.libs.product_services.xml"],
+ system_ext_specific: true,
+ srcs: ["system_ext/java/**/*.java"],
+ required: ["com.android.test.libs.system_ext.xml"],
}
prebuilt_etc {
- name: "com.android.test.libs.product_services.xml",
- src: "product_services/com.android.test.libs.product_services.xml",
+ name: "com.android.test.libs.system_ext.xml",
+ src: "system_ext/com.android.test.libs.system_ext.xml",
sub_dir: "permissions",
- product_services_specific: true,
+ system_ext_specific: true,
}
diff --git a/tests/libs-permissions/product_services/com.android.test.libs.product_services.xml b/tests/libs-permissions/system_ext/com.android.test.libs.system_ext.xml
similarity index 81%
rename from tests/libs-permissions/product_services/com.android.test.libs.product_services.xml
rename to tests/libs-permissions/system_ext/com.android.test.libs.system_ext.xml
index 082a9be..fa56004 100644
--- a/tests/libs-permissions/product_services/com.android.test.libs.product_services.xml
+++ b/tests/libs-permissions/system_ext/com.android.test.libs.system_ext.xml
@@ -15,6 +15,6 @@
-->
<permissions>
- <library name="com.android.test.libs.product_services"
- file="/product_services/framework/com.android.test.libs.product_services.jar" />
+ <library name="com.android.test.libs.system_ext"
+ file="/system_ext/framework/com.android.test.libs.system_ext.jar" />
</permissions>
diff --git a/tests/libs-permissions/product_services/java/com/android/test/libs/product_services/LibsProductServicesTest.java b/tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java
similarity index 84%
rename from tests/libs-permissions/product_services/java/com/android/test/libs/product_services/LibsProductServicesTest.java
rename to tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java
index dcbdae8..9999aba 100644
--- a/tests/libs-permissions/product_services/java/com/android/test/libs/product_services/LibsProductServicesTest.java
+++ b/tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.android.test.libs.product_services;
+package com.android.test.libs.system_ext;
/**
- * Test class for product_services libs.
+ * Test class for system_ext libs.
*/
-public class LibsProductServicesTest {
+public class LibsSystemExtTest {
/**
* Dummy method for testing.
diff --git a/tests/net/java/android/net/netlink/InetDiagSocketTest.java b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
index 2adbb06..b4f6e99 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;
@@ -45,7 +45,6 @@
import libcore.util.HexEncoding;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -152,9 +151,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 +168,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 +180,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 +200,16 @@
checkGetConnectionOwnerUid("::1", "::1");
}
+ /* 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/connectivity/PermissionMonitorTest.java b/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java
index cd2bd26..7029218 100644
--- a/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java
+++ b/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java
@@ -561,11 +561,17 @@
mNetdServiceMonitor.expectPermission(INetd.PERMISSION_NONE, new int[]{SYSTEM_UID1});
}
- private PackageInfo addPackage(String packageName, int uid, String[] permissions)
+ private PackageInfo setPackagePermissions(String packageName, int uid, String[] permissions)
throws Exception {
PackageInfo packageInfo = packageInfoWithPermissions(permissions, PARTITION_SYSTEM);
when(mPackageManager.getPackageInfo(eq(packageName), anyInt())).thenReturn(packageInfo);
when(mPackageManager.getPackagesForUid(eq(uid))).thenReturn(new String[]{packageName});
+ return packageInfo;
+ }
+
+ private PackageInfo addPackage(String packageName, int uid, String[] permissions)
+ throws Exception {
+ PackageInfo packageInfo = setPackagePermissions(packageName, uid, permissions);
mObserver.onPackageAdded(packageName, uid);
return packageInfo;
}
@@ -616,14 +622,13 @@
}
@Test
- public void testPackageUpdate() throws Exception {
+ public void testPackageRemoveThenAdd() throws Exception {
final NetdServiceMonitor mNetdServiceMonitor = new NetdServiceMonitor(mNetdService);
addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET, UPDATE_DEVICE_STATS});
mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET
| INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});
- // Remove and install the same package to simulate the update action
when(mPackageManager.getPackagesForUid(MOCK_UID1)).thenReturn(new String[]{});
mObserver.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1);
mNetdServiceMonitor.expectPermission(INetd.PERMISSION_UNINSTALLED, new int[]{MOCK_UID1});
@@ -633,6 +638,20 @@
}
@Test
+ public void testPackageUpdate() throws Exception {
+ final NetdServiceMonitor mNetdServiceMonitor = new NetdServiceMonitor(mNetdService);
+
+ addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {});
+ mNetdServiceMonitor.expectPermission(INetd.PERMISSION_NONE, new int[]{MOCK_UID1});
+
+ // When updating a package, the broadcast receiver gets two broadcasts (a remove and then an
+ // add), but the observer sees only one callback (an update).
+ setPackagePermissions(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET});
+ mObserver.onPackageChanged(MOCK_PACKAGE1, MOCK_UID1);
+ mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET, new int[]{MOCK_UID1});
+ }
+
+ @Test
public void testPackageUninstallWithMultiplePackages() throws Exception {
final NetdServiceMonitor mNetdServiceMonitor = new NetdServiceMonitor(mNetdService);
diff --git a/tests/privapp-permissions/Android.bp b/tests/privapp-permissions/Android.bp
index ca7864f..b661850 100644
--- a/tests/privapp-permissions/Android.bp
+++ b/tests/privapp-permissions/Android.bp
@@ -45,17 +45,17 @@
}
android_app {
- name: "ProductServicesPrivAppPermissionTest",
+ name: "SystemExtPrivAppPermissionTest",
sdk_version: "current",
privileged: true,
- manifest: "product_services/AndroidManifest.xml",
- product_services_specific: true,
- required: ["product_servicesprivapp-permissions-test.xml"],
+ manifest: "system_ext/AndroidManifest.xml",
+ system_ext_specific: true,
+ required: ["system_extprivapp-permissions-test.xml"],
}
prebuilt_etc {
- name: "product_servicesprivapp-permissions-test.xml",
- src: "product_services/privapp-permissions-test.xml",
+ name: "system_extprivapp-permissions-test.xml",
+ src: "system_ext/privapp-permissions-test.xml",
sub_dir: "permissions",
- product_services_specific: true,
+ system_ext_specific: true,
}
diff --git a/tests/privapp-permissions/product_services/AndroidManifest.xml b/tests/privapp-permissions/system_ext/AndroidManifest.xml
similarity index 97%
rename from tests/privapp-permissions/product_services/AndroidManifest.xml
rename to tests/privapp-permissions/system_ext/AndroidManifest.xml
index 511ddee..4a0e82f 100644
--- a/tests/privapp-permissions/product_services/AndroidManifest.xml
+++ b/tests/privapp-permissions/system_ext/AndroidManifest.xml
@@ -16,7 +16,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.framework.permission.privapp.tests.product_services">
+ package="com.android.framework.permission.privapp.tests.system_ext">
<!-- MANAGE_USB is signature|privileged -->
<uses-permission android:name="android.permission.MANAGE_USB"/>
diff --git a/tests/privapp-permissions/product_services/privapp-permissions-test.xml b/tests/privapp-permissions/system_ext/privapp-permissions-test.xml
similarity index 85%
rename from tests/privapp-permissions/product_services/privapp-permissions-test.xml
rename to tests/privapp-permissions/system_ext/privapp-permissions-test.xml
index 43baebb..ad63e86 100644
--- a/tests/privapp-permissions/product_services/privapp-permissions-test.xml
+++ b/tests/privapp-permissions/system_ext/privapp-permissions-test.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
- <privapp-permissions package="com.android.framework.permission.privapp.tests.product_services">
+ <privapp-permissions package="com.android.framework.permission.privapp.tests.system_ext">
<permission name="android.permission.MANAGE_USB"/>
</privapp-permissions>
</permissions>
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) {