Merge "Move NetworkStatsFactory into service directory"
diff --git a/api/current.txt b/api/current.txt
index 3ad2487..8b9a5af 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -35179,12 +35179,6 @@
field public static final String CACHED_NUMBER_TYPE = "numbertype";
field public static final String CACHED_PHOTO_ID = "photo_id";
field public static final String CACHED_PHOTO_URI = "photo_uri";
- field public static final String CALL_ID_APP_NAME = "call_id_app_name";
- field public static final String CALL_ID_DESCRIPTION = "call_id_description";
- field public static final String CALL_ID_DETAILS = "call_id_details";
- field public static final String CALL_ID_NAME = "call_id_name";
- field public static final String CALL_ID_NUISANCE_CONFIDENCE = "call_id_nuisance_confidence";
- field public static final String CALL_ID_PACKAGE_NAME = "call_id_package_name";
field public static final String CALL_SCREENING_APP_NAME = "call_screening_app_name";
field public static final String CALL_SCREENING_COMPONENT_NAME = "call_screening_component_name";
field public static final android.net.Uri CONTENT_FILTER_URI;
@@ -40424,6 +40418,8 @@
public final class ErrnoException extends java.lang.Exception {
ctor public ErrnoException(String, int);
ctor public ErrnoException(String, int, Throwable);
+ method @NonNull public java.io.IOException rethrowAsIOException() throws java.io.IOException;
+ method @NonNull public java.net.SocketException rethrowAsSocketException() throws java.net.SocketException;
field public final int errno;
}
@@ -41200,7 +41196,6 @@
method public android.telecom.PhoneAccountHandle getAccountHandle();
method public int getCallCapabilities();
method public int getCallDirection();
- method @Nullable public android.telecom.CallIdentification getCallIdentification();
method public int getCallProperties();
method public String getCallerDisplayName();
method public int getCallerDisplayNamePresentation();
@@ -41282,34 +41277,6 @@
field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5
}
- public final class CallIdentification implements android.os.Parcelable {
- method public int describeContents();
- method @NonNull public CharSequence getCallScreeningAppName();
- method @NonNull public String getCallScreeningPackageName();
- method @Nullable public CharSequence getDescription();
- method @Nullable public CharSequence getDetails();
- method @Nullable public CharSequence getName();
- method public int getNuisanceConfidence();
- method @Nullable public android.graphics.drawable.Icon getPhoto();
- method public void writeToParcel(android.os.Parcel, int);
- field public static final int CONFIDENCE_LIKELY_NOT_NUISANCE = -1; // 0xffffffff
- field public static final int CONFIDENCE_LIKELY_NUISANCE = 1; // 0x1
- field public static final int CONFIDENCE_NOT_NUISANCE = -2; // 0xfffffffe
- field public static final int CONFIDENCE_NUISANCE = 2; // 0x2
- field public static final int CONFIDENCE_UNKNOWN = 0; // 0x0
- field public static final android.os.Parcelable.Creator<android.telecom.CallIdentification> CREATOR;
- }
-
- public static final class CallIdentification.Builder {
- ctor public CallIdentification.Builder();
- method @NonNull public android.telecom.CallIdentification build();
- method @NonNull public android.telecom.CallIdentification.Builder setDescription(@Nullable CharSequence);
- method @NonNull public android.telecom.CallIdentification.Builder setDetails(@Nullable CharSequence);
- method @NonNull public android.telecom.CallIdentification.Builder setName(@Nullable CharSequence);
- method @NonNull public android.telecom.CallIdentification.Builder setNuisanceConfidence(int);
- method @NonNull public android.telecom.CallIdentification.Builder setPhoto(@Nullable android.graphics.drawable.Icon);
- }
-
public abstract class CallRedirectionService extends android.app.Service {
ctor public CallRedirectionService();
method public final void cancelCall();
@@ -41325,17 +41292,7 @@
ctor public CallScreeningService();
method public android.os.IBinder onBind(android.content.Intent);
method public abstract void onScreenCall(@NonNull android.telecom.Call.Details);
- method public final void provideCallIdentification(@NonNull android.telecom.Call.Details, @NonNull android.telecom.CallIdentification);
method public final void respondToCall(@NonNull android.telecom.Call.Details, @NonNull android.telecom.CallScreeningService.CallResponse);
- field public static final String ACTION_NUISANCE_CALL_STATUS_CHANGED = "android.telecom.action.NUISANCE_CALL_STATUS_CHANGED";
- field public static final int CALL_DURATION_LONG = 4; // 0x4
- field public static final int CALL_DURATION_MEDIUM = 3; // 0x3
- field public static final int CALL_DURATION_SHORT = 2; // 0x2
- field public static final int CALL_DURATION_VERY_SHORT = 1; // 0x1
- field public static final String EXTRA_CALL_DURATION = "android.telecom.extra.CALL_DURATION";
- field public static final String EXTRA_CALL_HANDLE = "android.telecom.extra.CALL_HANDLE";
- field public static final String EXTRA_CALL_TYPE = "android.telecom.extra.CALL_TYPE";
- field public static final String EXTRA_IS_NUISANCE = "android.telecom.extra.IS_NUISANCE";
field public static final String SERVICE_INTERFACE = "android.telecom.CallScreeningService";
}
@@ -41942,7 +41899,6 @@
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, String);
method @RequiresPermission(anyOf={android.Manifest.permission.CALL_PHONE, android.Manifest.permission.MANAGE_OWN_CALLS}) public void placeCall(android.net.Uri, android.os.Bundle);
method public void registerPhoneAccount(android.telecom.PhoneAccount);
- method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void reportNuisanceCallStatus(@NonNull android.net.Uri, boolean);
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void showInCallScreen(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void silenceRinger();
method public void unregisterPhoneAccount(android.telecom.PhoneAccountHandle);
diff --git a/api/system-current.txt b/api/system-current.txt
index 94f9323..cf55fbe 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -3494,16 +3494,11 @@
package android.net.util {
public final class SocketUtils {
- method public static void addArpEntry(@NonNull java.net.Inet4Address, @NonNull android.net.MacAddress, @NonNull String, @NonNull java.io.FileDescriptor) throws java.io.IOException;
- method public static void attachControlPacketFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
- method public static void attachDhcpFilter(@NonNull java.io.FileDescriptor) throws java.net.SocketException;
- method public static void attachRaFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
method public static void bindSocketToInterface(@NonNull java.io.FileDescriptor, @NonNull String) throws android.system.ErrnoException;
method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
method @NonNull public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int);
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
- method public static void setSocketTimeValueOption(@NonNull java.io.FileDescriptor, int, int, long) throws android.system.ErrnoException;
}
}
@@ -7711,7 +7706,7 @@
package android.telephony.mbms.vendor {
- public class MbmsDownloadServiceBase extends android.os.Binder {
+ public class MbmsDownloadServiceBase extends android.os.Binder implements android.os.IInterface {
ctor public MbmsDownloadServiceBase();
method public int addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException;
method public int addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException;
@@ -7744,7 +7739,7 @@
method public void updateGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>);
}
- public class MbmsStreamingServiceBase extends android.os.Binder {
+ public class MbmsStreamingServiceBase extends android.os.Binder implements android.os.IInterface {
ctor public MbmsStreamingServiceBase();
method public android.os.IBinder asBinder();
method public void dispose(int) throws android.os.RemoteException;
diff --git a/api/test-current.txt b/api/test-current.txt
index 16852e4..e813523 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -913,16 +913,11 @@
package android.net.util {
public final class SocketUtils {
- method public static void addArpEntry(@NonNull java.net.Inet4Address, @NonNull android.net.MacAddress, @NonNull String, @NonNull java.io.FileDescriptor) throws java.io.IOException;
- method public static void attachControlPacketFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
- method public static void attachDhcpFilter(@NonNull java.io.FileDescriptor) throws java.net.SocketException;
- method public static void attachRaFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
method public static void bindSocketToInterface(@NonNull java.io.FileDescriptor, @NonNull String) throws android.system.ErrnoException;
method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
method @NonNull public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int);
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
- method public static void setSocketTimeValueOption(@NonNull java.io.FileDescriptor, int, int, long) throws android.system.ErrnoException;
}
}
@@ -1594,7 +1589,7 @@
package android.telephony.mbms.vendor {
- public class MbmsDownloadServiceBase extends android.os.Binder {
+ public class MbmsDownloadServiceBase extends android.os.Binder implements android.os.IInterface {
ctor public MbmsDownloadServiceBase();
method public int addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException;
method public int addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException;
@@ -1627,7 +1622,7 @@
method public void updateGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>);
}
- public class MbmsStreamingServiceBase extends android.os.Binder {
+ public class MbmsStreamingServiceBase extends android.os.Binder implements android.os.IInterface {
ctor public MbmsStreamingServiceBase();
method public android.os.IBinder asBinder();
method public void dispose(int) throws android.os.RemoteException;
diff --git a/core/java/android/app/ApplicationLoaders.java b/core/java/android/app/ApplicationLoaders.java
index faa30f3..2e59b90 100644
--- a/core/java/android/app/ApplicationLoaders.java
+++ b/core/java/android/app/ApplicationLoaders.java
@@ -145,8 +145,7 @@
*/
public void createAndCacheNonBootclasspathSystemClassLoaders(SharedLibraryInfo[] libs) {
if (mSystemLibsCacheMap != null) {
- Log.wtf(TAG, "Already cached.");
- return;
+ throw new IllegalStateException("Already cached.");
}
mSystemLibsCacheMap = new HashMap<String, CachedClassLoader>();
@@ -159,7 +158,8 @@
/**
* Caches a single non-bootclasspath class loader.
*
- * All of this library's dependencies must have previously been cached.
+ * All of this library's dependencies must have previously been cached. Otherwise, an exception
+ * is thrown.
*/
private void createAndCacheNonBootclasspathSystemClassLoader(SharedLibraryInfo lib) {
String path = lib.getPath();
@@ -174,9 +174,8 @@
CachedClassLoader cached = mSystemLibsCacheMap.get(dependencyPath);
if (cached == null) {
- Log.e(TAG, "Failed to find dependency " + dependencyPath
- + " of cached library " + path);
- return;
+ throw new IllegalStateException("Failed to find dependency " + dependencyPath
+ + " of cachedlibrary " + path);
}
sharedLibraries.add(cached.loader);
@@ -189,8 +188,8 @@
null /*cacheKey*/, null /*classLoaderName*/, sharedLibraries /*sharedLibraries*/);
if (classLoader == null) {
- Log.e(TAG, "Failed to cache " + path);
- return;
+ // bad configuration or break in classloading code
+ throw new IllegalStateException("Failed to cache " + path);
}
CachedClassLoader cached = new CachedClassLoader();
@@ -215,7 +214,7 @@
*
* If there is an error or the cache is not available, this returns null.
*/
- private ClassLoader getCachedNonBootclasspathSystemLib(String zip, ClassLoader parent,
+ public ClassLoader getCachedNonBootclasspathSystemLib(String zip, ClassLoader parent,
String classLoaderName, List<ClassLoader> sharedLibraries) {
if (mSystemLibsCacheMap == null) {
return null;
diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java
index d2d886b..dd3fff8 100644
--- a/core/java/android/net/NetworkUtils.java
+++ b/core/java/android/net/NetworkUtils.java
@@ -24,7 +24,6 @@
import android.util.Pair;
import java.io.FileDescriptor;
-import java.io.IOException;
import java.math.BigInteger;
import java.net.Inet4Address;
import java.net.Inet6Address;
@@ -45,32 +44,6 @@
private static final String TAG = "NetworkUtils";
/**
- * Attaches a socket filter that accepts DHCP packets to the given socket.
- */
- @UnsupportedAppUsage
- public native static void attachDhcpFilter(FileDescriptor fd) throws SocketException;
-
- /**
- * Attaches a socket filter that accepts ICMPv6 router advertisements to the given socket.
- * @param fd the socket's {@link FileDescriptor}.
- * @param packetType the hardware address type, one of ARPHRD_*.
- */
- @UnsupportedAppUsage
- public native static void attachRaFilter(FileDescriptor fd, int packetType) throws SocketException;
-
- /**
- * Attaches a socket filter that accepts L2-L4 signaling traffic required for IP connectivity.
- *
- * This includes: all ARP, ICMPv6 RS/RA/NS/NA messages, and DHCPv4 exchanges.
- *
- * @param fd the socket's {@link FileDescriptor}.
- * @param packetType the hardware address type, one of ARPHRD_*.
- */
- @UnsupportedAppUsage
- public native static void attachControlPacketFilter(FileDescriptor fd, int packetType)
- throws SocketException;
-
- /**
* Attaches a socket filter that drops all of incoming packets.
* @param fd the socket's {@link FileDescriptor}.
*/
@@ -178,18 +151,6 @@
public static native void resNetworkCancel(FileDescriptor fd);
/**
- * Add an entry into the ARP cache.
- */
- public static void addArpEntry(Inet4Address ipv4Addr, MacAddress ethAddr, String ifname,
- FileDescriptor fd) throws IOException {
- addArpEntry(ethAddr.toByteArray(), ipv4Addr.getAddress(), ifname, fd);
- }
-
- private static native void addArpEntry(byte[] ethAddr, byte[] netAddr, String ifname,
- FileDescriptor fd) throws IOException;
-
-
- /**
* Get the tcp repair window associated with the {@code fd}.
*
* @param fd the tcp socket's {@link FileDescriptor}.
diff --git a/core/java/android/net/util/SocketUtils.java b/core/java/android/net/util/SocketUtils.java
index 6f8aece..1364d8c 100644
--- a/core/java/android/net/util/SocketUtils.java
+++ b/core/java/android/net/util/SocketUtils.java
@@ -23,21 +23,17 @@
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.TestApi;
-import android.net.MacAddress;
import android.net.NetworkUtils;
import android.system.ErrnoException;
import android.system.NetlinkSocketAddress;
import android.system.Os;
import android.system.PacketSocketAddress;
-import android.system.StructTimeval;
import libcore.io.IoBridge;
import java.io.FileDescriptor;
import java.io.IOException;
-import java.net.Inet4Address;
import java.net.SocketAddress;
-import java.net.SocketException;
/**
* Collection of utilities to interact with raw sockets.
@@ -85,57 +81,11 @@
}
/**
- * Set an option on a socket that takes a time value argument.
- */
- public static void setSocketTimeValueOption(
- @NonNull FileDescriptor fd, int level, int option, long millis) throws ErrnoException {
- Os.setsockoptTimeval(fd, level, option, StructTimeval.fromMillis(millis));
- }
-
- /**
* @see IoBridge#closeAndSignalBlockedThreads(FileDescriptor)
*/
public static void closeSocket(@Nullable FileDescriptor fd) throws IOException {
IoBridge.closeAndSignalBlockedThreads(fd);
}
- /**
- * Attaches a socket filter that accepts DHCP packets to the given socket.
- */
- public static void attachDhcpFilter(@NonNull FileDescriptor fd) throws SocketException {
- NetworkUtils.attachDhcpFilter(fd);
- }
-
- /**
- * Attaches a socket filter that accepts ICMPv6 router advertisements to the given socket.
- * @param fd the socket's {@link FileDescriptor}.
- * @param packetType the hardware address type, one of ARPHRD_*.
- */
- public static void attachRaFilter(@NonNull FileDescriptor fd, int packetType)
- throws SocketException {
- NetworkUtils.attachRaFilter(fd, packetType);
- }
-
- /**
- * Attaches a socket filter that accepts L2-L4 signaling traffic required for IP connectivity.
- *
- * This includes: all ARP, ICMPv6 RS/RA/NS/NA messages, and DHCPv4 exchanges.
- *
- * @param fd the socket's {@link FileDescriptor}.
- * @param packetType the hardware address type, one of ARPHRD_*.
- */
- public static void attachControlPacketFilter(@NonNull FileDescriptor fd, int packetType)
- throws SocketException {
- NetworkUtils.attachControlPacketFilter(fd, packetType);
- }
-
- /**
- * Add an entry into the ARP cache.
- */
- public static void addArpEntry(@NonNull Inet4Address ipv4Addr, @NonNull MacAddress ethAddr,
- @NonNull String ifname, @NonNull FileDescriptor fd) throws IOException {
- NetworkUtils.addArpEntry(ipv4Addr, ethAddr, ifname, fd);
- }
-
private SocketUtils() {}
}
diff --git a/core/java/android/os/SELinux.java b/core/java/android/os/SELinux.java
index 8ffafe4..86d9f89 100644
--- a/core/java/android/os/SELinux.java
+++ b/core/java/android/os/SELinux.java
@@ -31,12 +31,15 @@
public class SELinux {
private static final String TAG = "SELinux";
- /** Keep in sync with ./external/libselinux/include/selinux/android.h */
+ /** Keep in sync with ./external/selinux/libselinux/include/selinux/android.h */
private static final int SELINUX_ANDROID_RESTORECON_NOCHANGE = 1;
private static final int SELINUX_ANDROID_RESTORECON_VERBOSE = 2;
private static final int SELINUX_ANDROID_RESTORECON_RECURSE = 4;
private static final int SELINUX_ANDROID_RESTORECON_FORCE = 8;
private static final int SELINUX_ANDROID_RESTORECON_DATADATA = 16;
+ private static final int SELINUX_ANDROID_RESTORECON_SKIPCE = 32;
+ private static final int SELINUX_ANDROID_RESTORECON_CROSS_FILESYSTEMS = 64;
+ private static final int SELINUX_ANDROID_RESTORECON_SKIP_SEHASH = 128;
/**
* Determine whether SELinux is disabled or enabled.
@@ -175,7 +178,8 @@
@UnsupportedAppUsage
public static boolean restoreconRecursive(File file) {
try {
- return native_restorecon(file.getCanonicalPath(), SELINUX_ANDROID_RESTORECON_RECURSE);
+ return native_restorecon(file.getCanonicalPath(),
+ SELINUX_ANDROID_RESTORECON_RECURSE | SELINUX_ANDROID_RESTORECON_SKIP_SEHASH);
} catch (IOException e) {
Slog.e(TAG, "Error getting canonical path. Restorecon failed for " +
file.getPath(), e);
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index 44adc1c..ef28f07 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -35,7 +35,6 @@
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.DataUsageFeedback;
-import android.telecom.CallIdentification;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -605,69 +604,6 @@
public static final String BLOCK_REASON = "block_reason";
/**
- * The package name of the {@link android.telecom.CallScreeningService} which provided
- * {@link android.telecom.CallIdentification} for this call.
- * <P>Type: TEXT</P>
- */
- public static final String CALL_ID_PACKAGE_NAME = "call_id_package_name";
-
- /**
- * The app name of the {@link android.telecom.CallScreeningService} which provided
- * {@link android.telecom.CallIdentification} for this call.
- * <P>Type: TEXT</P>
- */
- public static final String CALL_ID_APP_NAME = "call_id_app_name";
-
- /**
- * The {@link CallIdentification#getName() name} of a call, as provided by the
- * {@link android.telecom.CallScreeningService}.
- * <p>
- * The name is provided by the app identified by {@link #CALL_ID_PACKAGE_NAME} and
- * {@link #CALL_ID_APP_NAME}.
- * <P>Type: TEXT</P>
- */
- public static final String CALL_ID_NAME = "call_id_name";
-
- /**
- * The {@link CallIdentification#getDescription() description} of a call, as provided by the
- * {@link android.telecom.CallScreeningService}.
- * <p>
- * The description is provided by the app identified by {@link #CALL_ID_PACKAGE_NAME} and
- * {@link #CALL_ID_APP_NAME}.
- * <P>Type: TEXT</P>
- */
- public static final String CALL_ID_DESCRIPTION = "call_id_description";
-
- /**
- * The {@link CallIdentification#getDetails() details} of a call, as provided by the
- * {@link android.telecom.CallScreeningService}.
- * <p>
- * The details field is provided by the app identified by {@link #CALL_ID_PACKAGE_NAME} and
- * {@link #CALL_ID_APP_NAME}.
- * <P>Type: TEXT</P>
- */
- public static final String CALL_ID_DETAILS = "call_id_details";
-
- /**
- * The {@link CallIdentification#getNuisanceConfidence() nuisance confidence} of a call, as
- * provided by the {@link android.telecom.CallScreeningService}.
- * <p>
- * Valid values are defined in {@link CallIdentification}, and include:
- * <ul>
- * <li>{@link CallIdentification#CONFIDENCE_NOT_NUISANCE}</li>
- * <li>{@link CallIdentification#CONFIDENCE_LIKELY_NOT_NUISANCE}</li>
- * <li>{@link CallIdentification#CONFIDENCE_UNKNOWN}</li>
- * <li>{@link CallIdentification#CONFIDENCE_LIKELY_NUISANCE}</li>
- * <li>{@link CallIdentification#CONFIDENCE_NUISANCE}</li>
- * </ul>
- * <p>
- * The nuisance confidence is provided by the app identified by
- * {@link #CALL_ID_PACKAGE_NAME} and {@link #CALL_ID_APP_NAME}.
- * <P>Type: INTEGER</P>
- */
- public static final String CALL_ID_NUISANCE_CONFIDENCE = "call_id_nuisance_confidence";
-
- /**
* Adds a call to the call log.
*
* @param ci the CallerInfo object to get the target contact from. Can be null
@@ -696,8 +632,7 @@
presentation, callType, features, accountHandle, start, duration,
dataUsage, false /* addForAllUsers */, null /* userToBeInsertedTo */,
false /* isRead */, Calls.BLOCK_REASON_NOT_BLOCKED /* callBlockReason */,
- null /* callScreeningAppName */, null /* callScreeningComponentName */,
- null /* callIdentification */);
+ null /* callScreeningAppName */, null /* callScreeningComponentName */);
}
@@ -737,8 +672,7 @@
features, accountHandle, start, duration, dataUsage, addForAllUsers,
userToBeInsertedTo, false /* isRead */ , Calls.BLOCK_REASON_NOT_BLOCKED
/* callBlockReason */, null /* callScreeningAppName */,
- null /* callScreeningComponentName */,
- null /* callIdentification */);
+ null /* callScreeningComponentName */);
}
/**
@@ -784,7 +718,7 @@
int features, PhoneAccountHandle accountHandle, long start, int duration,
Long dataUsage, boolean addForAllUsers, UserHandle userToBeInsertedTo,
boolean isRead, int callBlockReason, CharSequence callScreeningAppName,
- String callScreeningComponentName, CallIdentification callIdentification) {
+ String callScreeningComponentName) {
if (VERBOSE_LOG) {
Log.v(LOG_TAG, String.format("Add call: number=%s, user=%s, for all=%s",
number, userToBeInsertedTo, addForAllUsers));
@@ -839,26 +773,6 @@
values.put(CALL_SCREENING_APP_NAME, charSequenceToString(callScreeningAppName));
values.put(CALL_SCREENING_COMPONENT_NAME, callScreeningComponentName);
- if (callIdentification != null) {
- values.put(CALL_ID_PACKAGE_NAME, callIdentification.getCallScreeningPackageName());
- values.put(CALL_ID_APP_NAME,
- charSequenceToString(callIdentification.getCallScreeningAppName()));
- values.put(CALL_ID_NAME,
- charSequenceToString(callIdentification.getName()));
- values.put(CALL_ID_DESCRIPTION,
- charSequenceToString(callIdentification.getDescription()));
- values.put(CALL_ID_DETAILS,
- charSequenceToString(callIdentification.getDetails()));
- values.put(CALL_ID_NUISANCE_CONFIDENCE, callIdentification.getNuisanceConfidence());
- } else {
- values.putNull(CALL_ID_PACKAGE_NAME);
- values.putNull(CALL_ID_APP_NAME);
- values.putNull(CALL_ID_NAME);
- values.putNull(CALL_ID_DESCRIPTION);
- values.putNull(CALL_ID_DETAILS);
- values.putNull(CALL_ID_NUISANCE_CONFIDENCE);
- }
-
if ((ci != null) && (ci.contactIdOrZero > 0)) {
// Update usage information for the number associated with the contact ID.
// We need to use both the number and the ID for obtaining a data ID since other
diff --git a/core/java/android/service/carrier/CarrierIdentifier.java b/core/java/android/service/carrier/CarrierIdentifier.java
index 3b71aa7..4b3e7d3 100644
--- a/core/java/android/service/carrier/CarrierIdentifier.java
+++ b/core/java/android/service/carrier/CarrierIdentifier.java
@@ -20,6 +20,7 @@
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telephony.Rlog;
import android.telephony.TelephonyManager;
import com.android.internal.telephony.uicc.IccUtils;
@@ -223,7 +224,7 @@
+ "mcc=" + mMcc
+ ",mnc=" + mMnc
+ ",spn=" + mSpn
- + ",imsi=" + mImsi
+ + ",imsi=" + Rlog.pii(false, mImsi)
+ ",gid1=" + mGid1
+ ",gid2=" + mGid2
+ ",carrierid=" + mCarrierId
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java
index 2ee72bf..ae2deb9 100644
--- a/core/java/android/view/LayoutInflater.java
+++ b/core/java/android/view/LayoutInflater.java
@@ -512,7 +512,7 @@
String layout = res.getResourceEntryName(resource);
try {
- Class clazz = mPrecompiledClassLoader.loadClass("" + pkg + ".CompiledView");
+ Class clazz = Class.forName("" + pkg + ".CompiledView", false, mPrecompiledClassLoader);
Method inflater = clazz.getMethod(layout, Context.class, int.class);
View view = (View) inflater.invoke(null, mContext, resource);
@@ -731,8 +731,8 @@
if (constructor == null) {
// Class not found in the cache, see if it's real, and try to add it
- clazz = mContext.getClassLoader().loadClass(
- prefix != null ? (prefix + name) : name).asSubclass(View.class);
+ clazz = Class.forName(prefix != null ? (prefix + name) : name, false,
+ mContext.getClassLoader()).asSubclass(View.class);
if (mFilter != null && clazz != null) {
boolean allowed = mFilter.onLoadClass(clazz);
@@ -750,8 +750,8 @@
Boolean allowedState = mFilterMap.get(name);
if (allowedState == null) {
// New class -- remember whether it is allowed
- clazz = mContext.getClassLoader().loadClass(
- prefix != null ? (prefix + name) : name).asSubclass(View.class);
+ clazz = Class.forName(prefix != null ? (prefix + name) : name, false,
+ mContext.getClassLoader()).asSubclass(View.class);
boolean allowed = clazz != null && mFilter.onLoadClass(clazz);
mFilterMap.put(name, allowed);
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 6eace62..e508b02a 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -287,6 +287,7 @@
"libnativewindow",
"libhwui",
"libdl",
+ "libdl_android",
"libstatslog",
"server_configurable_flags",
],
diff --git a/core/jni/android_net_NetUtils.cpp b/core/jni/android_net_NetUtils.cpp
index 82acf6f..dd754f3 100644
--- a/core/jni/android_net_NetUtils.cpp
+++ b/core/jni/android_net_NetUtils.cpp
@@ -48,17 +48,6 @@
namespace android {
-static const uint32_t kEtherTypeOffset = offsetof(ether_header, ether_type);
-static const uint32_t kEtherHeaderLen = sizeof(ether_header);
-static const uint32_t kIPv4Protocol = kEtherHeaderLen + offsetof(iphdr, protocol);
-static const uint32_t kIPv4FlagsOffset = kEtherHeaderLen + offsetof(iphdr, frag_off);
-static const uint32_t kIPv6NextHeader = kEtherHeaderLen + offsetof(ip6_hdr, ip6_nxt);
-static const uint32_t kIPv6PayloadStart = kEtherHeaderLen + sizeof(ip6_hdr);
-static const uint32_t kICMPv6TypeOffset = kIPv6PayloadStart + offsetof(icmp6_hdr, icmp6_type);
-static const uint32_t kUDPSrcPortIndirectOffset = kEtherHeaderLen + offsetof(udphdr, source);
-static const uint32_t kUDPDstPortIndirectOffset = kEtherHeaderLen + offsetof(udphdr, dest);
-static const uint16_t kDhcpClientPort = 68;
-
constexpr int MAXPACKETSIZE = 8 * 1024;
// FrameworkListener limits the size of commands to 1024 bytes. TODO: fix this.
constexpr int MAXCMDSIZE = 1024;
@@ -84,149 +73,6 @@
env->Throw(reinterpret_cast<jthrowable>(exception));
}
-static void android_net_utils_attachDhcpFilter(JNIEnv *env, jobject clazz, jobject javaFd)
-{
- struct sock_filter filter_code[] = {
- // Check the protocol is UDP.
- BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kIPv4Protocol),
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, IPPROTO_UDP, 0, 6),
-
- // Check this is not a fragment.
- BPF_STMT(BPF_LD | BPF_H | BPF_ABS, kIPv4FlagsOffset),
- BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, IP_OFFMASK, 4, 0),
-
- // Get the IP header length.
- BPF_STMT(BPF_LDX | BPF_B | BPF_MSH, kEtherHeaderLen),
-
- // Check the destination port.
- BPF_STMT(BPF_LD | BPF_H | BPF_IND, kUDPDstPortIndirectOffset),
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, kDhcpClientPort, 0, 1),
-
- // Accept or reject.
- BPF_STMT(BPF_RET | BPF_K, 0xffff),
- BPF_STMT(BPF_RET | BPF_K, 0)
- };
- struct sock_fprog filter = {
- sizeof(filter_code) / sizeof(filter_code[0]),
- filter_code,
- };
-
- int fd = jniGetFDFromFileDescriptor(env, javaFd);
- if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) {
- jniThrowExceptionFmt(env, "java/net/SocketException",
- "setsockopt(SO_ATTACH_FILTER): %s", strerror(errno));
- }
-}
-
-static void android_net_utils_attachRaFilter(JNIEnv *env, jobject clazz, jobject javaFd,
- jint hardwareAddressType)
-{
- if (hardwareAddressType != ARPHRD_ETHER) {
- jniThrowExceptionFmt(env, "java/net/SocketException",
- "attachRaFilter only supports ARPHRD_ETHER");
- return;
- }
-
- struct sock_filter filter_code[] = {
- // Check IPv6 Next Header is ICMPv6.
- BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kIPv6NextHeader),
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, IPPROTO_ICMPV6, 0, 3),
-
- // Check ICMPv6 type is Router Advertisement.
- BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kICMPv6TypeOffset),
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ND_ROUTER_ADVERT, 0, 1),
-
- // Accept or reject.
- BPF_STMT(BPF_RET | BPF_K, 0xffff),
- BPF_STMT(BPF_RET | BPF_K, 0)
- };
- struct sock_fprog filter = {
- sizeof(filter_code) / sizeof(filter_code[0]),
- filter_code,
- };
-
- int fd = jniGetFDFromFileDescriptor(env, javaFd);
- if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) {
- jniThrowExceptionFmt(env, "java/net/SocketException",
- "setsockopt(SO_ATTACH_FILTER): %s", strerror(errno));
- }
-}
-
-// TODO: Move all this filter code into libnetutils.
-static void android_net_utils_attachControlPacketFilter(
- JNIEnv *env, jobject clazz, jobject javaFd, jint hardwareAddressType) {
- if (hardwareAddressType != ARPHRD_ETHER) {
- jniThrowExceptionFmt(env, "java/net/SocketException",
- "attachControlPacketFilter only supports ARPHRD_ETHER");
- return;
- }
-
- // Capture all:
- // - ARPs
- // - DHCPv4 packets
- // - Router Advertisements & Solicitations
- // - Neighbor Advertisements & Solicitations
- //
- // tcpdump:
- // arp or
- // '(ip and udp port 68)' or
- // '(icmp6 and ip6[40] >= 133 and ip6[40] <= 136)'
- struct sock_filter filter_code[] = {
- // Load the link layer next payload field.
- BPF_STMT(BPF_LD | BPF_H | BPF_ABS, kEtherTypeOffset),
-
- // Accept all ARP.
- // TODO: Figure out how to better filter ARPs on noisy networks.
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ETHERTYPE_ARP, 16, 0),
-
- // If IPv4:
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ETHERTYPE_IP, 0, 9),
-
- // Check the protocol is UDP.
- BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kIPv4Protocol),
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, IPPROTO_UDP, 0, 14),
-
- // Check this is not a fragment.
- BPF_STMT(BPF_LD | BPF_H | BPF_ABS, kIPv4FlagsOffset),
- BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, IP_OFFMASK, 12, 0),
-
- // Get the IP header length.
- BPF_STMT(BPF_LDX | BPF_B | BPF_MSH, kEtherHeaderLen),
-
- // Check the source port.
- BPF_STMT(BPF_LD | BPF_H | BPF_IND, kUDPSrcPortIndirectOffset),
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, kDhcpClientPort, 8, 0),
-
- // Check the destination port.
- BPF_STMT(BPF_LD | BPF_H | BPF_IND, kUDPDstPortIndirectOffset),
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, kDhcpClientPort, 6, 7),
-
- // IPv6 ...
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ETHERTYPE_IPV6, 0, 6),
- // ... check IPv6 Next Header is ICMPv6 (ignore fragments), ...
- BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kIPv6NextHeader),
- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, IPPROTO_ICMPV6, 0, 4),
- // ... and check the ICMPv6 type is one of RS/RA/NS/NA.
- BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kICMPv6TypeOffset),
- BPF_JUMP(BPF_JMP | BPF_JGE | BPF_K, ND_ROUTER_SOLICIT, 0, 2),
- BPF_JUMP(BPF_JMP | BPF_JGT | BPF_K, ND_NEIGHBOR_ADVERT, 1, 0),
-
- // Accept or reject.
- BPF_STMT(BPF_RET | BPF_K, 0xffff),
- BPF_STMT(BPF_RET | BPF_K, 0)
- };
- struct sock_fprog filter = {
- sizeof(filter_code) / sizeof(filter_code[0]),
- filter_code,
- };
-
- int fd = jniGetFDFromFileDescriptor(env, javaFd);
- if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) {
- jniThrowExceptionFmt(env, "java/net/SocketException",
- "setsockopt(SO_ATTACH_FILTER): %s", strerror(errno));
- }
-}
-
static void android_net_utils_attachDropAllBPFFilter(JNIEnv *env, jobject clazz, jobject javaFd)
{
struct sock_filter filter_code[] = {
@@ -389,46 +235,6 @@
return true;
}
-static void android_net_utils_addArpEntry(JNIEnv *env, jobject thiz, jbyteArray ethAddr,
- jbyteArray ipv4Addr, jstring ifname, jobject javaFd)
-{
- struct arpreq req = {};
- struct sockaddr_in& netAddrStruct = *reinterpret_cast<sockaddr_in*>(&req.arp_pa);
- struct sockaddr& ethAddrStruct = req.arp_ha;
-
- ethAddrStruct.sa_family = ARPHRD_ETHER;
- if (!checkLenAndCopy(env, ethAddr, ETH_ALEN, ethAddrStruct.sa_data)) {
- jniThrowException(env, "java/io/IOException", "Invalid ethAddr length");
- return;
- }
-
- netAddrStruct.sin_family = AF_INET;
- if (!checkLenAndCopy(env, ipv4Addr, sizeof(in_addr), &netAddrStruct.sin_addr)) {
- jniThrowException(env, "java/io/IOException", "Invalid ipv4Addr length");
- return;
- }
-
- int ifLen = env->GetStringLength(ifname);
- // IFNAMSIZ includes the terminating NULL character
- if (ifLen >= IFNAMSIZ) {
- jniThrowException(env, "java/io/IOException", "ifname too long");
- return;
- }
- env->GetStringUTFRegion(ifname, 0, ifLen, req.arp_dev);
-
- req.arp_flags = ATF_COM; // Completed entry (ha valid)
- int fd = jniGetFDFromFileDescriptor(env, javaFd);
- if (fd < 0) {
- jniThrowExceptionFmt(env, "java/io/IOException", "Invalid file descriptor");
- return;
- }
- // See also: man 7 arp
- if (ioctl(fd, SIOCSARP, &req)) {
- jniThrowExceptionFmt(env, "java/io/IOException", "ioctl error: %s", strerror(errno));
- return;
- }
-}
-
static jobject android_net_utils_resNetworkQuery(JNIEnv *env, jobject thiz, jint netId,
jstring dname, jint ns_class, jint ns_type, jint flags) {
const jsize javaCharsCount = env->GetStringLength(dname);
@@ -542,10 +348,6 @@
{ "bindSocketToNetwork", "(II)I", (void*) android_net_utils_bindSocketToNetwork },
{ "protectFromVpn", "(I)Z", (void*)android_net_utils_protectFromVpn },
{ "queryUserAccess", "(II)Z", (void*)android_net_utils_queryUserAccess },
- { "addArpEntry", "([B[BLjava/lang/String;Ljava/io/FileDescriptor;)V", (void*) android_net_utils_addArpEntry },
- { "attachDhcpFilter", "(Ljava/io/FileDescriptor;)V", (void*) android_net_utils_attachDhcpFilter },
- { "attachRaFilter", "(Ljava/io/FileDescriptor;I)V", (void*) android_net_utils_attachRaFilter },
- { "attachControlPacketFilter", "(Ljava/io/FileDescriptor;I)V", (void*) android_net_utils_attachControlPacketFilter },
{ "attachDropAllBPFFilter", "(Ljava/io/FileDescriptor;)V", (void*) android_net_utils_attachDropAllBPFFilter },
{ "detachBPFFilter", "(Ljava/io/FileDescriptor;)V", (void*) android_net_utils_detachBPFFilter },
{ "getTcpRepairWindow", "(Ljava/io/FileDescriptor;)Landroid/net/TcpRepairWindow;", (void*) android_net_utils_getTcpRepairWindow },
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index d8c68b4..d26425a 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -69,6 +69,7 @@
#include <android-base/file.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
+#include <cutils/ashmem.h>
#include <cutils/fs.h>
#include <cutils/multiuser.h>
#include <private/android_filesystem_config.h>
@@ -1486,6 +1487,11 @@
} else {
ALOGE("Unable to fetch Blastula pool socket file descriptor");
}
+
+ /*
+ * ashmem initialization to avoid dlopen overhead
+ */
+ ashmem_init();
}
/**
diff --git a/core/res/Android.bp b/core/res/Android.bp
index e66f1a2..4e60f8c 100644
--- a/core/res/Android.bp
+++ b/core/res/Android.bp
@@ -39,3 +39,12 @@
// PRODUCT-agnostic resource data like IDs and type definitions.
export_package_resources: true,
}
+
+// This logic can be removed once robolectric's transition to binary resources is complete
+filegroup {
+ name: "robolectric_framework_raw_res_files",
+ srcs: [
+ "assets/**/*",
+ "res/**/*",
+ ],
+}
diff --git a/core/tests/BTtraffic/Android.bp b/core/tests/BTtraffic/Android.bp
new file mode 100644
index 0000000..e508570
--- /dev/null
+++ b/core/tests/BTtraffic/Android.bp
@@ -0,0 +1,7 @@
+android_app {
+ name: "bttraffic",
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ sdk_version: "current",
+ certificate: "platform",
+}
diff --git a/core/tests/BTtraffic/Android.mk b/core/tests/BTtraffic/Android.mk
deleted file mode 100644
index f826ae9..0000000
--- a/core/tests/BTtraffic/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := \
- $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := bttraffic
-LOCAL_SDK_VERSION := current
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/tests/BroadcastRadioTests/Android.bp b/core/tests/BroadcastRadioTests/Android.bp
new file mode 100644
index 0000000..1d441f6
--- /dev/null
+++ b/core/tests/BroadcastRadioTests/Android.bp
@@ -0,0 +1,35 @@
+// Copyright (C) 2017 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.
+
+android_test {
+ name: "BroadcastRadioTests",
+ privileged: true,
+ certificate: "platform",
+ // TODO(b/13282254): uncomment when b/13282254 is fixed
+ // sdk_version: "current"
+ platform_apis: true,
+ static_libs: [
+ "compatibility-device-util",
+ "android-support-test",
+ "testng",
+ ],
+ libs: ["android.test.base"],
+ srcs: ["src/**/*.java"],
+ dex_preopt: {
+ enabled: false,
+ },
+ optimize: {
+ enabled: false,
+ },
+}
diff --git a/core/tests/BroadcastRadioTests/Android.mk b/core/tests/BroadcastRadioTests/Android.mk
deleted file mode 100644
index 24f0cf0..0000000
--- a/core/tests/BroadcastRadioTests/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2017 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := BroadcastRadioTests
-
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_CERTIFICATE := platform
-LOCAL_MODULE_TAGS := tests
-# TODO(b/13282254): uncomment when b/13282254 is fixed
-# LOCAL_SDK_VERSION := current
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test testng
-
-LOCAL_JAVA_LIBRARIES := android.test.base
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/ConnectivityManagerTest/Android.bp b/core/tests/ConnectivityManagerTest/Android.bp
new file mode 100644
index 0000000..a33d219
--- /dev/null
+++ b/core/tests/ConnectivityManagerTest/Android.bp
@@ -0,0 +1,26 @@
+// Copyright (C) 2010, 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.
+
+android_test {
+ name: "ConnectivityManagerTest",
+ libs: [
+ "android.test.runner",
+ "android.test.base",
+ ],
+ static_libs: ["junit"],
+ // Include all test java files.
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ certificate: "platform",
+}
diff --git a/core/tests/ConnectivityManagerTest/Android.mk b/core/tests/ConnectivityManagerTest/Android.mk
deleted file mode 100644
index 8c0a330..0000000
--- a/core/tests/ConnectivityManagerTest/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2010, 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.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := ConnectivityManagerTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/SvcMonitor/Android.bp b/core/tests/SvcMonitor/Android.bp
new file mode 100644
index 0000000..606e87c
--- /dev/null
+++ b/core/tests/SvcMonitor/Android.bp
@@ -0,0 +1,7 @@
+android_app {
+ name: "svcmonitor",
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ sdk_version: "current",
+ certificate: "platform",
+}
diff --git a/core/tests/SvcMonitor/Android.mk b/core/tests/SvcMonitor/Android.mk
deleted file mode 100644
index 94ddccb..0000000
--- a/core/tests/SvcMonitor/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := \
- $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := svcmonitor
-LOCAL_SDK_VERSION := current
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/tests/bandwidthtests/Android.bp b/core/tests/bandwidthtests/Android.bp
new file mode 100644
index 0000000..5d881b8
--- /dev/null
+++ b/core/tests/bandwidthtests/Android.bp
@@ -0,0 +1,26 @@
+// Copyright (C) 2011 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.
+
+android_test {
+ name: "BandwidthTests",
+ // Include all test java files.
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner",
+ "org.apache.http.legacy",
+ "android.test.base",
+ ],
+ static_libs: ["junit"],
+ platform_apis: true,
+}
diff --git a/core/tests/bandwidthtests/Android.mk b/core/tests/bandwidthtests/Android.mk
deleted file mode 100644
index dc80d00..0000000
--- a/core/tests/bandwidthtests/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2011 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := \
- android.test.runner \
- org.apache.http.legacy \
- android.test.base \
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-LOCAL_PACKAGE_NAME := BandwidthTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/tests/benchmarks/Android.bp b/core/tests/benchmarks/Android.bp
new file mode 100644
index 0000000..8dd7928
--- /dev/null
+++ b/core/tests/benchmarks/Android.bp
@@ -0,0 +1,24 @@
+// -*- mode: makefile -*-
+// Copyright (C) 2015 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.
+
+// build framework base core benchmarks
+// ============================================================
+
+java_library {
+ name: "frameworks-base-core-benchmarks",
+ installable: true,
+ srcs: ["src/**/*.java"],
+ libs: ["caliper-api-target"],
+}
diff --git a/core/tests/benchmarks/Android.mk b/core/tests/benchmarks/Android.mk
deleted file mode 100644
index 25181b5..0000000
--- a/core/tests/benchmarks/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- mode: makefile -*-
-# Copyright (C) 2015 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-# build framework base core benchmarks
-# ============================================================
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := frameworks-base-core-benchmarks
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_SRC_FILES := $(call all-java-files-under, src/)
-
-LOCAL_JAVA_LIBRARIES := \
- caliper-api-target
-
-include $(BUILD_JAVA_LIBRARY)
diff --git a/core/tests/bluetoothtests/Android.bp b/core/tests/bluetoothtests/Android.bp
new file mode 100644
index 0000000..4b6f9db
--- /dev/null
+++ b/core/tests/bluetoothtests/Android.bp
@@ -0,0 +1,12 @@
+android_test {
+ name: "BluetoothTests",
+ // Include all test java files.
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner",
+ "android.test.base",
+ ],
+ static_libs: ["junit"],
+ platform_apis: true,
+ certificate: "platform",
+}
diff --git a/core/tests/bluetoothtests/Android.mk b/core/tests/bluetoothtests/Android.mk
deleted file mode 100644
index bb4e302..0000000
--- a/core/tests/bluetoothtests/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-LOCAL_PACKAGE_NAME := BluetoothTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/tests/coretests/src/android/app/ApplicationLoadersTest.java b/core/tests/coretests/src/android/app/ApplicationLoadersTest.java
new file mode 100644
index 0000000..5aee4d3
--- /dev/null
+++ b/core/tests/coretests/src/android/app/ApplicationLoadersTest.java
@@ -0,0 +1,137 @@
+/*
+ * 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.app;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import android.content.pm.SharedLibraryInfo;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class ApplicationLoadersTest {
+
+ // a library installed onto the device with no dependencies
+ private static final String LIB_A = "/system/framework/android.hidl.base-V1.0-java.jar";
+ // a library installed onto the device which only depends on A
+ private static final String LIB_DEP_A = "/system/framework/android.hidl.manager-V1.0-java.jar";
+
+ private static SharedLibraryInfo createLib(String zip) {
+ return new SharedLibraryInfo(
+ zip, null /*packageName*/, null /*codePaths*/, null /*name*/, 0 /*version*/,
+ SharedLibraryInfo.TYPE_BUILTIN, null /*declaringPackage*/,
+ null /*dependentPackages*/, null /*dependencies*/);
+ }
+
+ @Test
+ public void testGetNonExistentLib() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ "/system/framework/nonexistentlib.jar", null, null, null));
+ }
+
+ @Test
+ public void testCacheExistentLib() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertNotEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, null, null));
+ }
+
+ @Test
+ public void testNonNullParent() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ ClassLoader parent = ClassLoader.getSystemClassLoader();
+ assertNotEquals(null, parent);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, parent, null, null));
+ }
+
+ @Test
+ public void testNonNullClassLoaderNamespace() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, "other classloader", null));
+ }
+
+ @Test
+ public void testDifferentSharedLibraries() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ // any other existent lib
+ ClassLoader dep = ClassLoader.getSystemClassLoader();
+ ArrayList<ClassLoader> sharedLibraries = new ArrayList<>();
+ sharedLibraries.add(dep);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, null, sharedLibraries));
+ }
+
+ @Test
+ public void testDependentLibs() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+ SharedLibraryInfo libB = createLib(LIB_DEP_A);
+ libB.addDependency(libA);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(
+ new SharedLibraryInfo[]{libA, libB});
+
+ ClassLoader loadA = loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, null, null);
+ assertNotEquals(null, loadA);
+
+ ArrayList<ClassLoader> sharedLibraries = new ArrayList<>();
+ sharedLibraries.add(loadA);
+
+ assertNotEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_DEP_A, null, null, sharedLibraries));
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testDependentLibsWrongOrder() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+ SharedLibraryInfo libB = createLib(LIB_DEP_A);
+ libB.addDependency(libA);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(
+ new SharedLibraryInfo[]{libB, libA});
+ }
+}
diff --git a/core/tests/featureflagtests/Android.bp b/core/tests/featureflagtests/Android.bp
new file mode 100644
index 0000000..a910499
--- /dev/null
+++ b/core/tests/featureflagtests/Android.bp
@@ -0,0 +1,19 @@
+android_test {
+ name: "FrameworksCoreFeatureFlagTests",
+ // We only want this apk build for tests.
+ // Include all test java files.
+ srcs: ["src/**/*.java"],
+ dxflags: ["--core-library"],
+ static_libs: [
+ "android-common",
+ "frameworks-core-util-lib",
+ "android-support-test",
+ ],
+ libs: [
+ "android.test.runner",
+ "android.test.base",
+ ],
+ platform_apis: true,
+ certificate: "platform",
+ test_suites: ["device-tests"],
+}
diff --git a/core/tests/featureflagtests/Android.mk b/core/tests/featureflagtests/Android.mk
deleted file mode 100644
index 5e518b6..0000000
--- a/core/tests/featureflagtests/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
-
-LOCAL_DX_FLAGS := --core-library
-LOCAL_STATIC_JAVA_LIBRARIES := android-common frameworks-core-util-lib android-support-test
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_PACKAGE_NAME := FrameworksCoreFeatureFlagTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/AutoLocTestApp/Android.bp b/core/tests/hosttests/test-apps/AutoLocTestApp/Android.bp
new file mode 100644
index 0000000..1442481
--- /dev/null
+++ b/core/tests/hosttests/test-apps/AutoLocTestApp/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "AutoLocTestApp",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/AutoLocTestApp/Android.mk b/core/tests/hosttests/test-apps/AutoLocTestApp/Android.mk
deleted file mode 100644
index b3cab48..0000000
--- a/core/tests/hosttests/test-apps/AutoLocTestApp/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := AutoLocTestApp
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v1/Android.bp b/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v1/Android.bp
new file mode 100644
index 0000000..438ed25
--- /dev/null
+++ b/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v1/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "AutoLocVersionedTestApp_v1",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v1/Android.mk b/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v1/Android.mk
deleted file mode 100644
index a887bac..0000000
--- a/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v1/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := AutoLocVersionedTestApp_v1
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v2/Android.bp b/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v2/Android.bp
new file mode 100644
index 0000000..2ac72a1
--- /dev/null
+++ b/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v2/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "AutoLocVersionedTestApp_v2",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v2/Android.mk b/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v2/Android.mk
deleted file mode 100644
index 69084bf..0000000
--- a/core/tests/hosttests/test-apps/AutoLocVersionedTestApp_v2/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := AutoLocVersionedTestApp_v2
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/Android.bp b/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/Android.bp
new file mode 100644
index 0000000..e06e82e
--- /dev/null
+++ b/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/Android.bp
@@ -0,0 +1,20 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "ExternalLocAllPermsTestApp",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["junit"],
+}
diff --git a/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/Android.mk b/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/Android.mk
deleted file mode 100644
index 5a545e5..0000000
--- a/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/Android.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-LOCAL_PACKAGE_NAME := ExternalLocAllPermsTestApp
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/ExternalLocPermsFLTestApp/Android.bp b/core/tests/hosttests/test-apps/ExternalLocPermsFLTestApp/Android.bp
new file mode 100644
index 0000000..c48dcd5
--- /dev/null
+++ b/core/tests/hosttests/test-apps/ExternalLocPermsFLTestApp/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "ExternalLocPermFLTestApp",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/ExternalLocPermsFLTestApp/Android.mk b/core/tests/hosttests/test-apps/ExternalLocPermsFLTestApp/Android.mk
deleted file mode 100644
index 9a05fa6..0000000
--- a/core/tests/hosttests/test-apps/ExternalLocPermsFLTestApp/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := ExternalLocPermFLTestApp
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/ExternalLocTestApp/Android.bp b/core/tests/hosttests/test-apps/ExternalLocTestApp/Android.bp
new file mode 100644
index 0000000..5c1c15a
--- /dev/null
+++ b/core/tests/hosttests/test-apps/ExternalLocTestApp/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "ExternalLocTestApp",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/ExternalLocTestApp/Android.mk b/core/tests/hosttests/test-apps/ExternalLocTestApp/Android.mk
deleted file mode 100644
index 5aec78a..0000000
--- a/core/tests/hosttests/test-apps/ExternalLocTestApp/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := ExternalLocTestApp
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v1/Android.bp b/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v1/Android.bp
new file mode 100644
index 0000000..13f5066
--- /dev/null
+++ b/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v1/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "ExternalLocVersionedTestApp_v1",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v1/Android.mk b/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v1/Android.mk
deleted file mode 100644
index 05f62cd..0000000
--- a/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v1/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := ExternalLocVersionedTestApp_v1
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v2/Android.bp b/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v2/Android.bp
new file mode 100644
index 0000000..e02ffb3
--- /dev/null
+++ b/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v2/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "ExternalLocVersionedTestApp_v2",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v2/Android.mk b/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v2/Android.mk
deleted file mode 100644
index aa31759..0000000
--- a/core/tests/hosttests/test-apps/ExternalLocVersionedTestApp_v2/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := ExternalLocVersionedTestApp_v2
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/ExternalSharedPerms/Android.bp b/core/tests/hosttests/test-apps/ExternalSharedPerms/Android.bp
new file mode 100644
index 0000000..de09800
--- /dev/null
+++ b/core/tests/hosttests/test-apps/ExternalSharedPerms/Android.bp
@@ -0,0 +1,21 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "ExternalSharedPermsTestApp",
+ srcs: ["src/**/*.java"],
+ static_libs: ["junit"],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/ExternalSharedPerms/Android.mk b/core/tests/hosttests/test-apps/ExternalSharedPerms/Android.mk
deleted file mode 100644
index b255c7e..0000000
--- a/core/tests/hosttests/test-apps/ExternalSharedPerms/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := ExternalSharedPermsTestApp
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/ExternalSharedPermsBT/Android.bp b/core/tests/hosttests/test-apps/ExternalSharedPermsBT/Android.bp
new file mode 100644
index 0000000..435144f
--- /dev/null
+++ b/core/tests/hosttests/test-apps/ExternalSharedPermsBT/Android.bp
@@ -0,0 +1,21 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "ExternalSharedPermsBTTestApp",
+ srcs: ["src/**/*.java"],
+ static_libs: ["junit"],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/ExternalSharedPermsBT/Android.mk b/core/tests/hosttests/test-apps/ExternalSharedPermsBT/Android.mk
deleted file mode 100644
index 428b1f8..0000000
--- a/core/tests/hosttests/test-apps/ExternalSharedPermsBT/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := ExternalSharedPermsBTTestApp
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/ExternalSharedPermsDiffKey/Android.bp b/core/tests/hosttests/test-apps/ExternalSharedPermsDiffKey/Android.bp
new file mode 100644
index 0000000..445bac9
--- /dev/null
+++ b/core/tests/hosttests/test-apps/ExternalSharedPermsDiffKey/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "ExternalSharedPermsDiffKeyTestApp",
+ srcs: ["src/**/*.java"],
+ static_libs: ["junit"],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "current",
+ certificate: "media",
+}
diff --git a/core/tests/hosttests/test-apps/ExternalSharedPermsDiffKey/Android.mk b/core/tests/hosttests/test-apps/ExternalSharedPermsDiffKey/Android.mk
deleted file mode 100644
index 93ece86..0000000
--- a/core/tests/hosttests/test-apps/ExternalSharedPermsDiffKey/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := ExternalSharedPermsDiffKeyTestApp
-
-LOCAL_CERTIFICATE := media
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/ExternalSharedPermsFL/Android.bp b/core/tests/hosttests/test-apps/ExternalSharedPermsFL/Android.bp
new file mode 100644
index 0000000..d1da399
--- /dev/null
+++ b/core/tests/hosttests/test-apps/ExternalSharedPermsFL/Android.bp
@@ -0,0 +1,21 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "ExternalSharedPermsFLTestApp",
+ srcs: ["src/**/*.java"],
+ static_libs: ["junit"],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/ExternalSharedPermsFL/Android.mk b/core/tests/hosttests/test-apps/ExternalSharedPermsFL/Android.mk
deleted file mode 100644
index b348966..0000000
--- a/core/tests/hosttests/test-apps/ExternalSharedPermsFL/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := ExternalSharedPermsFLTestApp
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/InternalLocTestApp/Android.bp b/core/tests/hosttests/test-apps/InternalLocTestApp/Android.bp
new file mode 100644
index 0000000..fab9d43
--- /dev/null
+++ b/core/tests/hosttests/test-apps/InternalLocTestApp/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "InternalLocTestApp",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/InternalLocTestApp/Android.mk b/core/tests/hosttests/test-apps/InternalLocTestApp/Android.mk
deleted file mode 100644
index 5b58e72..0000000
--- a/core/tests/hosttests/test-apps/InternalLocTestApp/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := InternalLocTestApp
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/MultiDexLegacyTestServicesTests/Android.bp b/core/tests/hosttests/test-apps/MultiDexLegacyTestServicesTests/Android.bp
new file mode 100644
index 0000000..dcf1687
--- /dev/null
+++ b/core/tests/hosttests/test-apps/MultiDexLegacyTestServicesTests/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2014 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.
+
+android_test {
+ name: "MultiDexLegacyTestServicesTests",
+ srcs: ["src/**/*.java"],
+ sdk_version: "9",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/core/tests/hosttests/test-apps/MultiDexLegacyTestServicesTests/Android.mk b/core/tests/hosttests/test-apps/MultiDexLegacyTestServicesTests/Android.mk
deleted file mode 100644
index 85304b6..0000000
--- a/core/tests/hosttests/test-apps/MultiDexLegacyTestServicesTests/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (C) 2014 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := MultiDexLegacyTestServicesTests
-
-LOCAL_SDK_VERSION := 9
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_PACKAGE)
-
diff --git a/core/tests/hosttests/test-apps/NoLocTestApp/Android.bp b/core/tests/hosttests/test-apps/NoLocTestApp/Android.bp
new file mode 100644
index 0000000..50a2de4
--- /dev/null
+++ b/core/tests/hosttests/test-apps/NoLocTestApp/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "NoLocTestApp",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/NoLocTestApp/Android.mk b/core/tests/hosttests/test-apps/NoLocTestApp/Android.mk
deleted file mode 100644
index 11916b0..0000000
--- a/core/tests/hosttests/test-apps/NoLocTestApp/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := NoLocTestApp
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v1/Android.bp b/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v1/Android.bp
new file mode 100644
index 0000000..4bc9edc
--- /dev/null
+++ b/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v1/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "NoLocVersionedTestApp_v1",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v1/Android.mk b/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v1/Android.mk
deleted file mode 100644
index 36413ee..0000000
--- a/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v1/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := NoLocVersionedTestApp_v1
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v2/Android.bp b/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v2/Android.bp
new file mode 100644
index 0000000..dd2952b
--- /dev/null
+++ b/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v2/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "NoLocVersionedTestApp_v2",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v2/Android.mk b/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v2/Android.mk
deleted file mode 100644
index 27d03b0..0000000
--- a/core/tests/hosttests/test-apps/NoLocVersionedTestApp_v2/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := NoLocVersionedTestApp_v2
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/SharedUid/32/Android.bp b/core/tests/hosttests/test-apps/SharedUid/32/Android.bp
new file mode 100644
index 0000000..f3e3ede
--- /dev/null
+++ b/core/tests/hosttests/test-apps/SharedUid/32/Android.bp
@@ -0,0 +1,31 @@
+//
+// Copyright (C) 2014 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.
+//
+
+// This makefile shows how to build a shared library and an activity that
+// bundles the shared library and calls it using JNI.
+
+// Build activity
+
+android_test {
+ name: "PMTest_Java32",
+ srcs: ["**/*.java"],
+ compile_multilib: "32",
+ jni_libs: ["libpmtest32"],
+ optimize: {
+ enabled: false,
+ },
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/SharedUid/32/Android.mk b/core/tests/hosttests/test-apps/SharedUid/32/Android.mk
deleted file mode 100644
index 7b44f9e..0000000
--- a/core/tests/hosttests/test-apps/SharedUid/32/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Copyright (C) 2014 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.
-#
-
-# This makefile shows how to build a shared library and an activity that
-# bundles the shared library and calls it using JNI.
-
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(TOP_LOCAL_PATH)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := PMTest_Java32
-LOCAL_MULTILIB := 32
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JNI_SHARED_LIBRARIES = libpmtest32
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/SharedUid/64/Android.bp b/core/tests/hosttests/test-apps/SharedUid/64/Android.bp
new file mode 100644
index 0000000..5d9c0b5
--- /dev/null
+++ b/core/tests/hosttests/test-apps/SharedUid/64/Android.bp
@@ -0,0 +1,31 @@
+//
+// Copyright (C) 2014 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.
+//
+
+// This makefile shows how to build a shared library and an activity that
+// bundles the shared library and calls it using JNI.
+
+// Build activity
+
+android_test {
+ name: "PMTest_Java64",
+ srcs: ["**/*.java"],
+ compile_multilib: "64",
+ jni_libs: ["libpmtest64"],
+ optimize: {
+ enabled: false,
+ },
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/SharedUid/64/Android.mk b/core/tests/hosttests/test-apps/SharedUid/64/Android.mk
deleted file mode 100644
index cc088c1a..0000000
--- a/core/tests/hosttests/test-apps/SharedUid/64/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Copyright (C) 2014 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.
-#
-
-# This makefile shows how to build a shared library and an activity that
-# bundles the shared library and calls it using JNI.
-
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(TOP_LOCAL_PATH)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := PMTest_Java64
-LOCAL_MULTILIB := 64
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JNI_SHARED_LIBRARIES = libpmtest64
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/SharedUid/Android.mk b/core/tests/hosttests/test-apps/SharedUid/Android.mk
deleted file mode 100644
index 5053e7d..0000000
--- a/core/tests/hosttests/test-apps/SharedUid/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/core/tests/hosttests/test-apps/SharedUid/dual/Android.bp b/core/tests/hosttests/test-apps/SharedUid/dual/Android.bp
new file mode 100644
index 0000000..c42192d
--- /dev/null
+++ b/core/tests/hosttests/test-apps/SharedUid/dual/Android.bp
@@ -0,0 +1,44 @@
+//
+// Copyright (C) 2014 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.
+//
+
+// This makefile shows how to build a shared library and an activity that
+// bundles the shared library and calls it using JNI.
+
+// Build activity
+
+android_test {
+ name: "PMTest_Java_dual",
+ srcs: ["**/*.java"],
+ compile_multilib: "both",
+ jni_libs: ["libpmtestdual"],
+ optimize: {
+ enabled: false,
+ },
+ manifest: "dual/AndroidManifest.xml",
+ sdk_version: "current",
+}
+
+android_test {
+ name: "PMTest_Java_multiarch",
+ srcs: ["**/*.java"],
+ compile_multilib: "both",
+ manifest: "multiarch/AndroidManifest.xml",
+ jni_libs: ["libpmtestdual"],
+ optimize: {
+ enabled: false,
+ },
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/SharedUid/dual/Android.mk b/core/tests/hosttests/test-apps/SharedUid/dual/Android.mk
deleted file mode 100644
index 5bcd078..0000000
--- a/core/tests/hosttests/test-apps/SharedUid/dual/Android.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# Copyright (C) 2014 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.
-#
-
-# This makefile shows how to build a shared library and an activity that
-# bundles the shared library and calls it using JNI.
-
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(TOP_LOCAL_PATH)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := PMTest_Java_dual
-LOCAL_MULTILIB := both
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JNI_SHARED_LIBRARIES = libpmtestdual
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_MANIFEST_FILE := dual/AndroidManifest.xml
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_PACKAGE)
-
-LOCAL_PATH:= $(TOP_LOCAL_PATH)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := PMTest_Java_multiarch
-LOCAL_MULTILIB := both
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MANIFEST_FILE := multiarch/AndroidManifest.xml
-
-LOCAL_JNI_SHARED_LIBRARIES = libpmtestdual
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/SharedUid/java_only/Android.bp b/core/tests/hosttests/test-apps/SharedUid/java_only/Android.bp
new file mode 100644
index 0000000..baedc6e
--- /dev/null
+++ b/core/tests/hosttests/test-apps/SharedUid/java_only/Android.bp
@@ -0,0 +1,29 @@
+//
+// Copyright (C) 2014 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.
+//
+
+// This makefile shows how to build a shared library and an activity that
+// bundles the shared library and calls it using JNI.
+
+// Build activity
+
+android_test {
+ name: "PMTest_Java",
+ srcs: ["**/*.java"],
+ optimize: {
+ enabled: false,
+ },
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/SharedUid/java_only/Android.mk b/core/tests/hosttests/test-apps/SharedUid/java_only/Android.mk
deleted file mode 100644
index b846756..0000000
--- a/core/tests/hosttests/test-apps/SharedUid/java_only/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Copyright (C) 2014 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.
-#
-
-# This makefile shows how to build a shared library and an activity that
-# bundles the shared library and calls it using JNI.
-
-TOP_LOCAL_PATH:= $(call my-dir)
-
-# Build activity
-
-LOCAL_PATH:= $(TOP_LOCAL_PATH)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := PMTest_Java
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SDK_VERSION := current
-include $(BUILD_PACKAGE)
-
-# ============================================================
-
-# Also build all of the sub-targets under this one: the shared library.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/tests/hosttests/test-apps/SimpleTestApp/Android.bp b/core/tests/hosttests/test-apps/SimpleTestApp/Android.bp
new file mode 100644
index 0000000..5f443bd
--- /dev/null
+++ b/core/tests/hosttests/test-apps/SimpleTestApp/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "SimpleTestApp",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/SimpleTestApp/Android.mk b/core/tests/hosttests/test-apps/SimpleTestApp/Android.mk
deleted file mode 100644
index 82543aa..0000000
--- a/core/tests/hosttests/test-apps/SimpleTestApp/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := SimpleTestApp
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v1_ext/Android.bp b/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v1_ext/Android.bp
new file mode 100644
index 0000000..800e083
--- /dev/null
+++ b/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v1_ext/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "UpdateExtToIntLocTestApp_v1_ext",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v1_ext/Android.mk b/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v1_ext/Android.mk
deleted file mode 100644
index f2baefe..0000000
--- a/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v1_ext/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := UpdateExtToIntLocTestApp_v1_ext
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v2_int/Android.bp b/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v2_int/Android.bp
new file mode 100644
index 0000000..299887c
--- /dev/null
+++ b/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v2_int/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "UpdateExtToIntLocTestApp_v2_int",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v2_int/Android.mk b/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v2_int/Android.mk
deleted file mode 100644
index 492c326..0000000
--- a/core/tests/hosttests/test-apps/UpdateExtToIntLocTestApp_v2_int/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := UpdateExtToIntLocTestApp_v2_int
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v1_ext/Android.bp b/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v1_ext/Android.bp
new file mode 100644
index 0000000..1530422
--- /dev/null
+++ b/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v1_ext/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "UpdateExternalLocTestApp_v1_ext",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v1_ext/Android.mk b/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v1_ext/Android.mk
deleted file mode 100644
index 45867f7..0000000
--- a/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v1_ext/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := UpdateExternalLocTestApp_v1_ext
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v2_none/Android.bp b/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v2_none/Android.bp
new file mode 100644
index 0000000..4c7975e
--- /dev/null
+++ b/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v2_none/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "UpdateExternalLocTestApp_v2_none",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v2_none/Android.mk b/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v2_none/Android.mk
deleted file mode 100644
index 780a9d72..0000000
--- a/core/tests/hosttests/test-apps/UpdateExternalLocTestApp_v2_none/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := UpdateExternalLocTestApp_v2_none
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/VersatileTestApp_Auto/Android.bp b/core/tests/hosttests/test-apps/VersatileTestApp_Auto/Android.bp
new file mode 100644
index 0000000..c6b60c3
--- /dev/null
+++ b/core/tests/hosttests/test-apps/VersatileTestApp_Auto/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "VersatileTestApp_Auto",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/VersatileTestApp_Auto/Android.mk b/core/tests/hosttests/test-apps/VersatileTestApp_Auto/Android.mk
deleted file mode 100644
index fc42bc4a..0000000
--- a/core/tests/hosttests/test-apps/VersatileTestApp_Auto/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := VersatileTestApp_Auto
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/VersatileTestApp_External/Android.bp b/core/tests/hosttests/test-apps/VersatileTestApp_External/Android.bp
new file mode 100644
index 0000000..db521ef
--- /dev/null
+++ b/core/tests/hosttests/test-apps/VersatileTestApp_External/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "VersatileTestApp_External",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/VersatileTestApp_External/Android.mk b/core/tests/hosttests/test-apps/VersatileTestApp_External/Android.mk
deleted file mode 100644
index c72a92c..0000000
--- a/core/tests/hosttests/test-apps/VersatileTestApp_External/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := VersatileTestApp_External
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/VersatileTestApp_Internal/Android.bp b/core/tests/hosttests/test-apps/VersatileTestApp_Internal/Android.bp
new file mode 100644
index 0000000..ca059302
--- /dev/null
+++ b/core/tests/hosttests/test-apps/VersatileTestApp_Internal/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "VersatileTestApp_Internal",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/VersatileTestApp_Internal/Android.mk b/core/tests/hosttests/test-apps/VersatileTestApp_Internal/Android.mk
deleted file mode 100644
index e477825e..0000000
--- a/core/tests/hosttests/test-apps/VersatileTestApp_Internal/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := VersatileTestApp_Internal
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/VersatileTestApp_None/Android.bp b/core/tests/hosttests/test-apps/VersatileTestApp_None/Android.bp
new file mode 100644
index 0000000..6e1aac7
--- /dev/null
+++ b/core/tests/hosttests/test-apps/VersatileTestApp_None/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2010 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.
+
+android_test {
+ name: "VersatileTestApp_None",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/core/tests/hosttests/test-apps/VersatileTestApp_None/Android.mk b/core/tests/hosttests/test-apps/VersatileTestApp_None/Android.mk
deleted file mode 100644
index 1fc516c4..0000000
--- a/core/tests/hosttests/test-apps/VersatileTestApp_None/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2010 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := VersatileTestApp_None
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/notificationtests/Android.bp b/core/tests/notificationtests/Android.bp
new file mode 100644
index 0000000..e744d5a
--- /dev/null
+++ b/core/tests/notificationtests/Android.bp
@@ -0,0 +1,15 @@
+android_test {
+ name: "NotificationStressTests",
+ // Include all test java files.
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner",
+ "android.test.base",
+ ],
+ // Could build against SDK if it wasn't for the @RepetitiveTest annotation.
+ platform_apis: true,
+ static_libs: [
+ "junit",
+ "ub-uiautomator",
+ ],
+}
diff --git a/core/tests/notificationtests/Android.mk b/core/tests/notificationtests/Android.mk
deleted file mode 100644
index 73ee8b8..0000000
--- a/core/tests/notificationtests/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_PACKAGE_NAME := NotificationStressTests
-# Could build against SDK if it wasn't for the @RepetitiveTest annotation.
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- junit \
- ub-uiautomator
-
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/tests/systemproperties/Android.bp b/core/tests/systemproperties/Android.bp
new file mode 100644
index 0000000..7ef1b9b
--- /dev/null
+++ b/core/tests/systemproperties/Android.bp
@@ -0,0 +1,16 @@
+android_test {
+ name: "FrameworksCoreSystemPropertiesTests",
+ // Include all test java files.
+ srcs: ["src/**/*.java"],
+ dxflags: ["--core-library"],
+ static_libs: [
+ "android-common",
+ "frameworks-core-util-lib",
+ ],
+ libs: [
+ "android.test.runner",
+ "android.test.base",
+ ],
+ platform_apis: true,
+ certificate: "platform",
+}
diff --git a/core/tests/systemproperties/Android.mk b/core/tests/systemproperties/Android.mk
deleted file mode 100644
index 3458be0..0000000
--- a/core/tests/systemproperties/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
-
-LOCAL_DX_FLAGS := --core-library
-LOCAL_STATIC_JAVA_LIBRARIES := android-common frameworks-core-util-lib
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_PACKAGE_NAME := FrameworksCoreSystemPropertiesTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/core/xsd/permission.xsd b/core/xsd/permission.xsd
index 2ef2d04..9520db7 100644
--- a/core/xsd/permission.xsd
+++ b/core/xsd/permission.xsd
@@ -20,33 +20,33 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="permissions">
<xs:complexType>
- <xs:sequence>
- <xs:element name="group" type="group" maxOccurs="unbounded"/>
- <xs:element name="permission" type="permission" maxOccurs="unbounded"/>
- <xs:element name="assign-permission" type="assign-permission" maxOccurs="unbounded"/>
- <xs:element name="split-permission" type="split-permission" maxOccurs="unbounded"/>
- <xs:element name="library" type="library" maxOccurs="unbounded"/>
- <xs:element name="feature" type="feature" maxOccurs="unbounded"/>
- <xs:element name="unavailable-feature" type="unavailable-feature" maxOccurs="unbounded"/>
- <xs:element name="allow-in-power-save-except-idle" type="allow-in-power-save-except-idle" maxOccurs="unbounded"/>
- <xs:element name="allow-in-power-save" type="allow-in-power-save" maxOccurs="unbounded"/>
- <xs:element name="allow-in-data-usage-save" type="allow-in-data-usage-save" maxOccurs="unbounded"/>
- <xs:element name="allow-unthrottled-location" type="allow-unthrottled-location" maxOccurs="unbounded"/>
- <xs:element name="allow-ignore-location-settings" type="allow-ignore-location-settings" maxOccurs="unbounded"/>
- <xs:element name="allow-implicit-broadcast" type="allow-implicit-broadcast" maxOccurs="unbounded"/>
- <xs:element name="app-link" type="app-link" maxOccurs="unbounded"/>
- <xs:element name="system-user-whitelisted-app" type="system-user-whitelisted-app" maxOccurs="unbounded"/>
- <xs:element name="system-user-blacklisted-app" type="system-user-blacklisted-app" maxOccurs="unbounded"/>
- <xs:element name="default-enabled-vr-app" type="default-enabled-vr-app" maxOccurs="unbounded"/>
- <xs:element name="backup-transport-whitelisted-service" type="backup-transport-whitelisted-service" maxOccurs="unbounded"/>
- <xs:element name="disabled-until-used-preinstalled-carrier-associated-app" type="disabled-until-used-preinstalled-carrier-associated-app" maxOccurs="unbounded"/>
- <xs:element name="disabled-until-used-preinstalled-carrier-app" type="disabled-until-used-preinstalled-carrier-app" maxOccurs="unbounded"/>
- <xs:element name="privapp-permissions" type="privapp-permissions" maxOccurs="unbounded"/>
- <xs:element name="oem-permissions" type="oem-permissions" maxOccurs="unbounded"/>
- <xs:element name="hidden-api-whitelisted-app" type="hidden-api-whitelisted-app" maxOccurs="unbounded"/>
- <xs:element name="allow-association" type="allow-association" maxOccurs="unbounded"/>
- <xs:element name="bugreport-whitelisted" type="bugreport-whitelisted" maxOccurs="unbounded"/>
- </xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="group" type="group"/>
+ <xs:element name="permission" type="permission"/>
+ <xs:element name="assign-permission" type="assign-permission"/>
+ <xs:element name="split-permission" type="split-permission"/>
+ <xs:element name="library" type="library"/>
+ <xs:element name="feature" type="feature"/>
+ <xs:element name="unavailable-feature" type="unavailable-feature"/>
+ <xs:element name="allow-in-power-save-except-idle" type="allow-in-power-save-except-idle"/>
+ <xs:element name="allow-in-power-save" type="allow-in-power-save"/>
+ <xs:element name="allow-in-data-usage-save" type="allow-in-data-usage-save"/>
+ <xs:element name="allow-unthrottled-location" type="allow-unthrottled-location"/>
+ <xs:element name="allow-ignore-location-settings" type="allow-ignore-location-settings"/>
+ <xs:element name="allow-implicit-broadcast" type="allow-implicit-broadcast"/>
+ <xs:element name="app-link" type="app-link"/>
+ <xs:element name="system-user-whitelisted-app" type="system-user-whitelisted-app"/>
+ <xs:element name="system-user-blacklisted-app" type="system-user-blacklisted-app"/>
+ <xs:element name="default-enabled-vr-app" type="default-enabled-vr-app"/>
+ <xs:element name="backup-transport-whitelisted-service" type="backup-transport-whitelisted-service"/>
+ <xs:element name="disabled-until-used-preinstalled-carrier-associated-app" type="disabled-until-used-preinstalled-carrier-associated-app"/>
+ <xs:element name="disabled-until-used-preinstalled-carrier-app" type="disabled-until-used-preinstalled-carrier-app"/>
+ <xs:element name="privapp-permissions" type="privapp-permissions"/>
+ <xs:element name="oem-permissions" type="oem-permissions"/>
+ <xs:element name="hidden-api-whitelisted-app" type="hidden-api-whitelisted-app"/>
+ <xs:element name="allow-association" type="allow-association"/>
+ <xs:element name="bugreport-whitelisted" type="bugreport-whitelisted"/>
+ </xs:choice>
</xs:complexType>
</xs:element>
<xs:complexType name="group">
diff --git a/core/xsd/schema/current.txt b/core/xsd/schema/current.txt
index c25bc14..771c1df 100644
--- a/core/xsd/schema/current.txt
+++ b/core/xsd/schema/current.txt
@@ -153,31 +153,31 @@
public class Permissions {
ctor public Permissions();
- method public java.util.List<com.android.xml.permission.configfile.AllowAssociation> getAllowAssociation();
- method public java.util.List<com.android.xml.permission.configfile.AllowIgnoreLocationSettings> getAllowIgnoreLocationSettings();
- method public java.util.List<com.android.xml.permission.configfile.AllowImplicitBroadcast> getAllowImplicitBroadcast();
- method public java.util.List<com.android.xml.permission.configfile.AllowInDataUsageSave> getAllowInDataUsageSave();
- method public java.util.List<com.android.xml.permission.configfile.AllowInPowerSave> getAllowInPowerSave();
- method public java.util.List<com.android.xml.permission.configfile.AllowInPowerSaveExceptIdle> getAllowInPowerSaveExceptIdle();
- method public java.util.List<com.android.xml.permission.configfile.AllowUnthrottledLocation> getAllowUnthrottledLocation();
- method public java.util.List<com.android.xml.permission.configfile.AppLink> getAppLink();
- method public java.util.List<com.android.xml.permission.configfile.AssignPermission> getAssignPermission();
- method public java.util.List<com.android.xml.permission.configfile.BackupTransportWhitelistedService> getBackupTransportWhitelistedService();
- method public java.util.List<com.android.xml.permission.configfile.BugreportWhitelisted> getBugreportWhitelisted();
- method public java.util.List<com.android.xml.permission.configfile.DefaultEnabledVrApp> getDefaultEnabledVrApp();
- method public java.util.List<com.android.xml.permission.configfile.DisabledUntilUsedPreinstalledCarrierApp> getDisabledUntilUsedPreinstalledCarrierApp();
- method public java.util.List<com.android.xml.permission.configfile.DisabledUntilUsedPreinstalledCarrierAssociatedApp> getDisabledUntilUsedPreinstalledCarrierAssociatedApp();
- method public java.util.List<com.android.xml.permission.configfile.Feature> getFeature();
- method public java.util.List<com.android.xml.permission.configfile.Group> getGroup();
- method public java.util.List<com.android.xml.permission.configfile.HiddenApiWhitelistedApp> getHiddenApiWhitelistedApp();
- method public java.util.List<com.android.xml.permission.configfile.Library> getLibrary();
- method public java.util.List<com.android.xml.permission.configfile.OemPermissions> getOemPermissions();
- method public java.util.List<com.android.xml.permission.configfile.Permission> getPermission();
- method public java.util.List<com.android.xml.permission.configfile.PrivappPermissions> getPrivappPermissions();
- method public java.util.List<com.android.xml.permission.configfile.SplitPermission> getSplitPermission();
- method public java.util.List<com.android.xml.permission.configfile.SystemUserBlacklistedApp> getSystemUserBlacklistedApp();
- method public java.util.List<com.android.xml.permission.configfile.SystemUserWhitelistedApp> getSystemUserWhitelistedApp();
- method public java.util.List<com.android.xml.permission.configfile.UnavailableFeature> getUnavailableFeature();
+ method public java.util.List<com.android.xml.permission.configfile.AllowAssociation> getAllowAssociation_optional();
+ method public java.util.List<com.android.xml.permission.configfile.AllowIgnoreLocationSettings> getAllowIgnoreLocationSettings_optional();
+ method public java.util.List<com.android.xml.permission.configfile.AllowImplicitBroadcast> getAllowImplicitBroadcast_optional();
+ method public java.util.List<com.android.xml.permission.configfile.AllowInDataUsageSave> getAllowInDataUsageSave_optional();
+ method public java.util.List<com.android.xml.permission.configfile.AllowInPowerSaveExceptIdle> getAllowInPowerSaveExceptIdle_optional();
+ method public java.util.List<com.android.xml.permission.configfile.AllowInPowerSave> getAllowInPowerSave_optional();
+ method public java.util.List<com.android.xml.permission.configfile.AllowUnthrottledLocation> getAllowUnthrottledLocation_optional();
+ method public java.util.List<com.android.xml.permission.configfile.AppLink> getAppLink_optional();
+ method public java.util.List<com.android.xml.permission.configfile.AssignPermission> getAssignPermission_optional();
+ method public java.util.List<com.android.xml.permission.configfile.BackupTransportWhitelistedService> getBackupTransportWhitelistedService_optional();
+ method public java.util.List<com.android.xml.permission.configfile.BugreportWhitelisted> getBugreportWhitelisted_optional();
+ method public java.util.List<com.android.xml.permission.configfile.DefaultEnabledVrApp> getDefaultEnabledVrApp_optional();
+ method public java.util.List<com.android.xml.permission.configfile.DisabledUntilUsedPreinstalledCarrierApp> getDisabledUntilUsedPreinstalledCarrierApp_optional();
+ method public java.util.List<com.android.xml.permission.configfile.DisabledUntilUsedPreinstalledCarrierAssociatedApp> getDisabledUntilUsedPreinstalledCarrierAssociatedApp_optional();
+ method public java.util.List<com.android.xml.permission.configfile.Feature> getFeature_optional();
+ method public java.util.List<com.android.xml.permission.configfile.Group> getGroup_optional();
+ method public java.util.List<com.android.xml.permission.configfile.HiddenApiWhitelistedApp> getHiddenApiWhitelistedApp_optional();
+ method public java.util.List<com.android.xml.permission.configfile.Library> getLibrary_optional();
+ method public java.util.List<com.android.xml.permission.configfile.OemPermissions> getOemPermissions_optional();
+ method public java.util.List<com.android.xml.permission.configfile.Permission> getPermission_optional();
+ method public java.util.List<com.android.xml.permission.configfile.PrivappPermissions> getPrivappPermissions_optional();
+ method public java.util.List<com.android.xml.permission.configfile.SplitPermission> getSplitPermission_optional();
+ method public java.util.List<com.android.xml.permission.configfile.SystemUserBlacklistedApp> getSystemUserBlacklistedApp_optional();
+ method public java.util.List<com.android.xml.permission.configfile.SystemUserWhitelistedApp> getSystemUserWhitelistedApp_optional();
+ method public java.util.List<com.android.xml.permission.configfile.UnavailableFeature> getUnavailableFeature_optional();
}
public class PrivappPermissions {
diff --git a/core/xsd/vts/Android.bp b/core/xsd/vts/Android.bp
new file mode 100644
index 0000000..9cf68c1
--- /dev/null
+++ b/core/xsd/vts/Android.bp
@@ -0,0 +1,34 @@
+//
+// 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.
+//
+
+cc_test {
+ name: "vts_permission_validate_test",
+ srcs: [
+ "ValidatePermission.cpp"
+ ],
+ static_libs: [
+ "android.hardware.audio.common.test.utility",
+ "libxml2",
+ ],
+ shared_libs: [
+ "liblog",
+ "libbase",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+}
diff --git a/location/Android.mk b/core/xsd/vts/Android.mk
similarity index 77%
rename from location/Android.mk
rename to core/xsd/vts/Android.mk
index 50509c6..a5754a4 100644
--- a/location/Android.mk
+++ b/core/xsd/vts/Android.mk
@@ -1,4 +1,5 @@
-# Copyright (C) 2010 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.
@@ -11,7 +12,11 @@
# 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.
+#
LOCAL_PATH := $(call my-dir)
-include $(call all-subdir-makefiles, $(LOCAL_PATH))
\ No newline at end of file
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := VtsValidatePermission
+include test/vts/tools/build/Android.host_config.mk
diff --git a/core/xsd/vts/AndroidTest.xml b/core/xsd/vts/AndroidTest.xml
new file mode 100644
index 0000000..e5cc9a0
--- /dev/null
+++ b/core/xsd/vts/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Config for VTS VtsValidatePermission.">
+ <option name="config-descriptor:metadata" key="plan" value="vts-treble" />
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+ <option name="abort-on-push-failure" value="false"/>
+ <option name="push-group" value="HostDrivenTest.push"/>
+ <option name="push" value="DATA/etc/permission.xsd->/data/local/tmp/permission.xsd"/>
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+ <option name="test-module-name" value="VtsValidatePermission"/>
+ <option name="binary-test-source" value="_32bit::DATA/nativetest/vts_permission_validate_test/vts_permission_validate_test" />
+ <option name="binary-test-source" value="_64bit::DATA/nativetest64/vts_permission_validate_test/vts_permission_validate_test" />
+ <option name="binary-test-type" value="gtest"/>
+ <option name="test-timeout" value="30s"/>
+ </test>
+</configuration>
diff --git a/core/xsd/vts/ValidatePermission.cpp b/core/xsd/vts/ValidatePermission.cpp
new file mode 100644
index 0000000..3499689
--- /dev/null
+++ b/core/xsd/vts/ValidatePermission.cpp
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+#include <dirent.h>
+#include <regex>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string>
+
+#include "android-base/logging.h"
+#include "utility/ValidateXml.h"
+
+static void get_files_in_dirs(const char* dir_path, std::vector<std::string>& files) {
+ DIR* d;
+ struct dirent* de;
+
+ d = opendir(dir_path);
+ if (d == nullptr) {
+ return;
+ }
+
+ while ((de = readdir(d))) {
+ if (de->d_type != DT_REG) {
+ continue;
+ }
+ if (std::regex_match(de->d_name, std::regex("(.*)(.xml)"))) {
+ files.push_back(de->d_name);
+ }
+ }
+ closedir(d);
+}
+
+TEST(CheckConfig, permission) {
+ RecordProperty("description",
+ "Verify that the permission file "
+ "is valid according to the schema");
+
+ const char* location = "/vendor/etc/permissions";
+
+ std::vector<std::string> files;
+ get_files_in_dirs(location, files);
+
+ for (std::string file_name : files) {
+ EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(file_name.c_str(), {location},
+ "/data/local/tmp/permission.xsd");
+ }
+}
diff --git a/keystore/tests/Android.bp b/keystore/tests/Android.bp
new file mode 100644
index 0000000..d382dd9
--- /dev/null
+++ b/keystore/tests/Android.bp
@@ -0,0 +1,23 @@
+// Copyright (C) 2017 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.
+
+android_test {
+ name: "KeystoreTests",
+ // LOCAL_MODULE := keystore
+ srcs: ["src/**/*.java"],
+ static_libs: ["android-support-test"],
+ platform_apis: true,
+ libs: ["android.test.runner"],
+ certificate: "platform",
+}
diff --git a/keystore/tests/Android.mk b/keystore/tests/Android.mk
deleted file mode 100644
index 596e5f5..0000000
--- a/keystore/tests/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2017 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# LOCAL_MODULE := keystore
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test
-
-LOCAL_PACKAGE_NAME := KeystoreTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
-
diff --git a/location/tests/Android.bp b/location/tests/Android.bp
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/location/tests/Android.bp
@@ -0,0 +1 @@
+
diff --git a/location/tests/Android.mk b/location/tests/Android.mk
deleted file mode 100644
index 57848f3..0000000
--- a/location/tests/Android.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(call all-makefiles-under, $(LOCAL_PATH))
\ No newline at end of file
diff --git a/location/tests/locationtests/Android.bp b/location/tests/locationtests/Android.bp
new file mode 100644
index 0000000..735ee0e
--- /dev/null
+++ b/location/tests/locationtests/Android.bp
@@ -0,0 +1,19 @@
+android_test {
+ name: "FrameworksLocationTests",
+ // Include all test java files.
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner",
+ "android.test.base",
+ ],
+ platform_apis: true,
+ static_libs: [
+ "android-support-test",
+ "core-test-rules",
+ "guava",
+ "mockito-target-minus-junit4",
+ "frameworks-base-testutils",
+ "truth-prebuilt",
+ ],
+ test_suites: ["device-tests"],
+}
diff --git a/location/tests/locationtests/Android.mk b/location/tests/locationtests/Android.mk
deleted file mode 100644
index b2fd8ec..0000000
--- a/location/tests/locationtests/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-LOCAL_PACKAGE_NAME := FrameworksLocationTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- core-test-rules \
- guava \
- mockito-target-minus-junit4 \
- frameworks-base-testutils \
- truth-prebuilt \
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-include $(BUILD_PACKAGE)
diff --git a/media/jni/Android.bp b/media/jni/Android.bp
index 5966192..7a41c77 100644
--- a/media/jni/Android.bp
+++ b/media/jni/Android.bp
@@ -151,6 +151,8 @@
"libutils", // Have to use shared lib to make libandroid_runtime behave correctly.
// Otherwise, AndroidRuntime::getJNIEnv() will return NULL.
+
+ "libcgrouprc", // LL-NDK
],
header_libs: ["libhardware_headers"],
diff --git a/media/tests/MediaFrameworkTest/Android.bp b/media/tests/MediaFrameworkTest/Android.bp
new file mode 100644
index 0000000..4fbd852
--- /dev/null
+++ b/media/tests/MediaFrameworkTest/Android.bp
@@ -0,0 +1,14 @@
+android_test {
+ name: "mediaframeworktest",
+ srcs: ["**/*.java"],
+ libs: [
+ "android.test.runner",
+ "android.test.base",
+ ],
+ static_libs: [
+ "mockito-target-minus-junit4",
+ "android-support-test",
+ "android-ex-camera2",
+ ],
+ platform_apis: true,
+}
diff --git a/media/tests/MediaFrameworkTest/Android.mk b/media/tests/MediaFrameworkTest/Android.mk
deleted file mode 100644
index fb473f0..0000000
--- a/media/tests/MediaFrameworkTest/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- mockito-target-minus-junit4 \
- android-support-test \
- android-ex-camera2
-
-LOCAL_PACKAGE_NAME := mediaframeworktest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
diff --git a/media/tests/MtpTests/Android.bp b/media/tests/MtpTests/Android.bp
new file mode 100644
index 0000000..1189430
--- /dev/null
+++ b/media/tests/MtpTests/Android.bp
@@ -0,0 +1,6 @@
+android_test {
+ name: "MtpTests",
+ srcs: ["**/*.java"],
+ static_libs: ["android-support-test"],
+ platform_apis: true,
+}
diff --git a/media/tests/MtpTests/Android.mk b/media/tests/MtpTests/Android.mk
deleted file mode 100644
index 6375ed3..0000000
--- a/media/tests/MtpTests/Android.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
-
-LOCAL_PACKAGE_NAME := MtpTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
diff --git a/packages/NetworkStack/Android.bp b/packages/NetworkStack/Android.bp
index 57a3db5..262e6f6 100644
--- a/packages/NetworkStack/Android.bp
+++ b/packages/NetworkStack/Android.bp
@@ -49,6 +49,27 @@
manifest: "AndroidManifestBase.xml",
}
+cc_library_shared {
+ name: "libnetworkstackutilsjni",
+ srcs: [
+ "jni/network_stack_utils_jni.cpp"
+ ],
+
+ shared_libs: [
+ "liblog",
+ "libcutils",
+ "libnativehelper",
+ ],
+ static_libs: [
+ "libpcap",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-unused-parameter",
+ ],
+}
+
java_defaults {
name: "NetworkStackAppCommon",
defaults: ["NetworkStackCommon"],
@@ -56,6 +77,7 @@
static_libs: [
"NetworkStackBase",
],
+ jni_libs: ["libnetworkstackutilsjni"],
// Resources already included in NetworkStackBase
resource_dirs: [],
jarjar_rules: "jarjar-rules-shared.txt",
diff --git a/packages/NetworkStack/jni/network_stack_utils_jni.cpp b/packages/NetworkStack/jni/network_stack_utils_jni.cpp
new file mode 100644
index 0000000..5544eaa
--- /dev/null
+++ b/packages/NetworkStack/jni/network_stack_utils_jni.cpp
@@ -0,0 +1,264 @@
+/*
+ * Copyright 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.
+ */
+
+#define LOG_TAG "NetworkStackUtils-JNI"
+
+#include <errno.h>
+#include <jni.h>
+#include <linux/filter.h>
+#include <linux/if_arp.h>
+#include <net/if.h>
+#include <netinet/ether.h>
+#include <netinet/icmp6.h>
+#include <netinet/ip.h>
+#include <netinet/ip6.h>
+#include <netinet/udp.h>
+#include <stdlib.h>
+
+#include <string>
+
+#include <nativehelper/JNIHelp.h>
+#include <utils/Log.h>
+
+namespace android {
+constexpr const char NETWORKSTACKUTILS_PKG_NAME[] = "android/net/util/NetworkStackUtils";
+
+static const uint32_t kEtherTypeOffset = offsetof(ether_header, ether_type);
+static const uint32_t kEtherHeaderLen = sizeof(ether_header);
+static const uint32_t kIPv4Protocol = kEtherHeaderLen + offsetof(iphdr, protocol);
+static const uint32_t kIPv4FlagsOffset = kEtherHeaderLen + offsetof(iphdr, frag_off);
+static const uint32_t kIPv6NextHeader = kEtherHeaderLen + offsetof(ip6_hdr, ip6_nxt);
+static const uint32_t kIPv6PayloadStart = kEtherHeaderLen + sizeof(ip6_hdr);
+static const uint32_t kICMPv6TypeOffset = kIPv6PayloadStart + offsetof(icmp6_hdr, icmp6_type);
+static const uint32_t kUDPSrcPortIndirectOffset = kEtherHeaderLen + offsetof(udphdr, source);
+static const uint32_t kUDPDstPortIndirectOffset = kEtherHeaderLen + offsetof(udphdr, dest);
+static const uint16_t kDhcpClientPort = 68;
+
+static bool checkLenAndCopy(JNIEnv* env, const jbyteArray& addr, int len, void* dst) {
+ if (env->GetArrayLength(addr) != len) {
+ return false;
+ }
+ env->GetByteArrayRegion(addr, 0, len, reinterpret_cast<jbyte*>(dst));
+ return true;
+}
+
+static void network_stack_utils_addArpEntry(JNIEnv *env, jobject thiz, jbyteArray ethAddr,
+ jbyteArray ipv4Addr, jstring ifname, jobject javaFd) {
+ arpreq req = {};
+ sockaddr_in& netAddrStruct = *reinterpret_cast<sockaddr_in*>(&req.arp_pa);
+ sockaddr& ethAddrStruct = req.arp_ha;
+
+ ethAddrStruct.sa_family = ARPHRD_ETHER;
+ if (!checkLenAndCopy(env, ethAddr, ETH_ALEN, ethAddrStruct.sa_data)) {
+ jniThrowException(env, "java/io/IOException", "Invalid ethAddr length");
+ return;
+ }
+
+ netAddrStruct.sin_family = AF_INET;
+ if (!checkLenAndCopy(env, ipv4Addr, sizeof(in_addr), &netAddrStruct.sin_addr)) {
+ jniThrowException(env, "java/io/IOException", "Invalid ipv4Addr length");
+ return;
+ }
+
+ int ifLen = env->GetStringLength(ifname);
+ // IFNAMSIZ includes the terminating NULL character
+ if (ifLen >= IFNAMSIZ) {
+ jniThrowException(env, "java/io/IOException", "ifname too long");
+ return;
+ }
+ env->GetStringUTFRegion(ifname, 0, ifLen, req.arp_dev);
+
+ req.arp_flags = ATF_COM; // Completed entry (ha valid)
+ int fd = jniGetFDFromFileDescriptor(env, javaFd);
+ if (fd < 0) {
+ jniThrowExceptionFmt(env, "java/io/IOException", "Invalid file descriptor");
+ return;
+ }
+ // See also: man 7 arp
+ if (ioctl(fd, SIOCSARP, &req)) {
+ jniThrowExceptionFmt(env, "java/io/IOException", "ioctl error: %s", strerror(errno));
+ return;
+ }
+}
+
+static void network_stack_utils_attachDhcpFilter(JNIEnv *env, jobject clazz, jobject javaFd) {
+ static sock_filter filter_code[] = {
+ // Check the protocol is UDP.
+ BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kIPv4Protocol),
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, IPPROTO_UDP, 0, 6),
+
+ // Check this is not a fragment.
+ BPF_STMT(BPF_LD | BPF_H | BPF_ABS, kIPv4FlagsOffset),
+ BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, IP_OFFMASK, 4, 0),
+
+ // Get the IP header length.
+ BPF_STMT(BPF_LDX | BPF_B | BPF_MSH, kEtherHeaderLen),
+
+ // Check the destination port.
+ BPF_STMT(BPF_LD | BPF_H | BPF_IND, kUDPDstPortIndirectOffset),
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, kDhcpClientPort, 0, 1),
+
+ // Accept or reject.
+ BPF_STMT(BPF_RET | BPF_K, 0xffff),
+ BPF_STMT(BPF_RET | BPF_K, 0)
+ };
+ static const sock_fprog filter = {
+ sizeof(filter_code) / sizeof(filter_code[0]),
+ filter_code,
+ };
+
+ int fd = jniGetFDFromFileDescriptor(env, javaFd);
+ if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) {
+ jniThrowExceptionFmt(env, "java/net/SocketException",
+ "setsockopt(SO_ATTACH_FILTER): %s", strerror(errno));
+ }
+}
+
+static void network_stack_utils_attachRaFilter(JNIEnv *env, jobject clazz, jobject javaFd,
+ jint hardwareAddressType) {
+ if (hardwareAddressType != ARPHRD_ETHER) {
+ jniThrowExceptionFmt(env, "java/net/SocketException",
+ "attachRaFilter only supports ARPHRD_ETHER");
+ return;
+ }
+
+ static sock_filter filter_code[] = {
+ // Check IPv6 Next Header is ICMPv6.
+ BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kIPv6NextHeader),
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, IPPROTO_ICMPV6, 0, 3),
+
+ // Check ICMPv6 type is Router Advertisement.
+ BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kICMPv6TypeOffset),
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ND_ROUTER_ADVERT, 0, 1),
+
+ // Accept or reject.
+ BPF_STMT(BPF_RET | BPF_K, 0xffff),
+ BPF_STMT(BPF_RET | BPF_K, 0)
+ };
+ static const sock_fprog filter = {
+ sizeof(filter_code) / sizeof(filter_code[0]),
+ filter_code,
+ };
+
+ int fd = jniGetFDFromFileDescriptor(env, javaFd);
+ if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) {
+ jniThrowExceptionFmt(env, "java/net/SocketException",
+ "setsockopt(SO_ATTACH_FILTER): %s", strerror(errno));
+ }
+}
+
+// TODO: Move all this filter code into libnetutils.
+static void network_stack_utils_attachControlPacketFilter(
+ JNIEnv *env, jobject clazz, jobject javaFd, jint hardwareAddressType) {
+ if (hardwareAddressType != ARPHRD_ETHER) {
+ jniThrowExceptionFmt(env, "java/net/SocketException",
+ "attachControlPacketFilter only supports ARPHRD_ETHER");
+ return;
+ }
+
+ // Capture all:
+ // - ARPs
+ // - DHCPv4 packets
+ // - Router Advertisements & Solicitations
+ // - Neighbor Advertisements & Solicitations
+ //
+ // tcpdump:
+ // arp or
+ // '(ip and udp port 68)' or
+ // '(icmp6 and ip6[40] >= 133 and ip6[40] <= 136)'
+ static sock_filter filter_code[] = {
+ // Load the link layer next payload field.
+ BPF_STMT(BPF_LD | BPF_H | BPF_ABS, kEtherTypeOffset),
+
+ // Accept all ARP.
+ // TODO: Figure out how to better filter ARPs on noisy networks.
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ETHERTYPE_ARP, 16, 0),
+
+ // If IPv4:
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ETHERTYPE_IP, 0, 9),
+
+ // Check the protocol is UDP.
+ BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kIPv4Protocol),
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, IPPROTO_UDP, 0, 14),
+
+ // Check this is not a fragment.
+ BPF_STMT(BPF_LD | BPF_H | BPF_ABS, kIPv4FlagsOffset),
+ BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, IP_OFFMASK, 12, 0),
+
+ // Get the IP header length.
+ BPF_STMT(BPF_LDX | BPF_B | BPF_MSH, kEtherHeaderLen),
+
+ // Check the source port.
+ BPF_STMT(BPF_LD | BPF_H | BPF_IND, kUDPSrcPortIndirectOffset),
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, kDhcpClientPort, 8, 0),
+
+ // Check the destination port.
+ BPF_STMT(BPF_LD | BPF_H | BPF_IND, kUDPDstPortIndirectOffset),
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, kDhcpClientPort, 6, 7),
+
+ // IPv6 ...
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ETHERTYPE_IPV6, 0, 6),
+ // ... check IPv6 Next Header is ICMPv6 (ignore fragments), ...
+ BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kIPv6NextHeader),
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, IPPROTO_ICMPV6, 0, 4),
+ // ... and check the ICMPv6 type is one of RS/RA/NS/NA.
+ BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kICMPv6TypeOffset),
+ BPF_JUMP(BPF_JMP | BPF_JGE | BPF_K, ND_ROUTER_SOLICIT, 0, 2),
+ BPF_JUMP(BPF_JMP | BPF_JGT | BPF_K, ND_NEIGHBOR_ADVERT, 1, 0),
+
+ // Accept or reject.
+ BPF_STMT(BPF_RET | BPF_K, 0xffff),
+ BPF_STMT(BPF_RET | BPF_K, 0)
+ };
+ static const sock_fprog filter = {
+ sizeof(filter_code) / sizeof(filter_code[0]),
+ filter_code,
+ };
+
+ int fd = jniGetFDFromFileDescriptor(env, javaFd);
+ if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) {
+ jniThrowExceptionFmt(env, "java/net/SocketException",
+ "setsockopt(SO_ATTACH_FILTER): %s", strerror(errno));
+ }
+}
+
+/*
+ * JNI registration.
+ */
+static const JNINativeMethod gNetworkStackUtilsMethods[] = {
+ /* name, signature, funcPtr */
+ { "addArpEntry", "([B[BLjava/lang/String;Ljava/io/FileDescriptor;)V", (void*) network_stack_utils_addArpEntry },
+ { "attachDhcpFilter", "(Ljava/io/FileDescriptor;)V", (void*) network_stack_utils_attachDhcpFilter },
+ { "attachRaFilter", "(Ljava/io/FileDescriptor;I)V", (void*) network_stack_utils_attachRaFilter },
+ { "attachControlPacketFilter", "(Ljava/io/FileDescriptor;I)V", (void*) network_stack_utils_attachControlPacketFilter },
+};
+
+extern "C" jint JNI_OnLoad(JavaVM* vm, void*) {
+ JNIEnv *env;
+ if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
+ ALOGE("ERROR: GetEnv failed");
+ return JNI_ERR;
+ }
+
+ if (jniRegisterNativeMethods(env, NETWORKSTACKUTILS_PKG_NAME,
+ gNetworkStackUtilsMethods, NELEM(gNetworkStackUtilsMethods)) < 0) {
+ return JNI_ERR;
+ }
+
+ return JNI_VERSION_1_6;
+
+}
+}; // namespace android
\ No newline at end of file
diff --git a/packages/NetworkStack/src/android/net/apf/ApfFilter.java b/packages/NetworkStack/src/android/net/apf/ApfFilter.java
index d2f3259..663e2f1 100644
--- a/packages/NetworkStack/src/android/net/apf/ApfFilter.java
+++ b/packages/NetworkStack/src/android/net/apf/ApfFilter.java
@@ -49,7 +49,6 @@
import android.net.metrics.RaEvent;
import android.net.util.InterfaceParams;
import android.net.util.NetworkStackUtils;
-import android.net.util.SocketUtils;
import android.os.PowerManager;
import android.os.SystemClock;
import android.system.ErrnoException;
@@ -478,7 +477,7 @@
SocketAddress addr = makePacketSocketAddress(
(short) ETH_P_IPV6, mInterfaceParams.index);
Os.bind(socket, addr);
- SocketUtils.attachRaFilter(socket, mApfCapabilities.apfPacketFormat);
+ NetworkStackUtils.attachRaFilter(socket, mApfCapabilities.apfPacketFormat);
} catch(SocketException|ErrnoException e) {
Log.e(TAG, "Error starting filter", e);
return;
diff --git a/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java b/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java
index 79d6a55..64adc0d 100644
--- a/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java
+++ b/packages/NetworkStack/src/android/net/dhcp/DhcpClient.java
@@ -51,6 +51,7 @@
import android.net.metrics.DhcpErrorEvent;
import android.net.metrics.IpConnectivityLog;
import android.net.util.InterfaceParams;
+import android.net.util.NetworkStackUtils;
import android.net.util.SocketUtils;
import android.os.Message;
import android.os.SystemClock;
@@ -319,7 +320,7 @@
mPacketSock = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IP);
SocketAddress addr = makePacketSocketAddress((short) ETH_P_IP, mIface.index);
Os.bind(mPacketSock, addr);
- SocketUtils.attachDhcpFilter(mPacketSock);
+ NetworkStackUtils.attachDhcpFilter(mPacketSock);
} catch(SocketException|ErrnoException e) {
Log.e(TAG, "Error creating packet socket", e);
return false;
diff --git a/packages/NetworkStack/src/android/net/dhcp/DhcpServer.java b/packages/NetworkStack/src/android/net/dhcp/DhcpServer.java
index cd993e9..8832eaa 100644
--- a/packages/NetworkStack/src/android/net/dhcp/DhcpServer.java
+++ b/packages/NetworkStack/src/android/net/dhcp/DhcpServer.java
@@ -45,6 +45,7 @@
import android.net.INetworkStackStatusCallback;
import android.net.MacAddress;
import android.net.TrafficStats;
+import android.net.util.NetworkStackUtils;
import android.net.util.SharedLog;
import android.net.util.SocketUtils;
import android.os.Handler;
@@ -207,7 +208,7 @@
@Override
public void addArpEntry(@NonNull Inet4Address ipv4Addr, @NonNull MacAddress ethAddr,
@NonNull String ifname, @NonNull FileDescriptor fd) throws IOException {
- SocketUtils.addArpEntry(ipv4Addr, ethAddr, ifname, fd);
+ NetworkStackUtils.addArpEntry(ipv4Addr, ethAddr, ifname, fd);
}
@Override
diff --git a/packages/NetworkStack/src/android/net/ip/ConnectivityPacketTracker.java b/packages/NetworkStack/src/android/net/ip/ConnectivityPacketTracker.java
index de54824..eb49218 100644
--- a/packages/NetworkStack/src/android/net/ip/ConnectivityPacketTracker.java
+++ b/packages/NetworkStack/src/android/net/ip/ConnectivityPacketTracker.java
@@ -25,8 +25,8 @@
import android.net.util.ConnectivityPacketSummary;
import android.net.util.InterfaceParams;
+import android.net.util.NetworkStackUtils;
import android.net.util.PacketReader;
-import android.net.util.SocketUtils;
import android.os.Handler;
import android.system.ErrnoException;
import android.system.Os;
@@ -103,7 +103,7 @@
FileDescriptor s = null;
try {
s = Os.socket(AF_PACKET, SOCK_RAW | SOCK_NONBLOCK, 0);
- SocketUtils.attachControlPacketFilter(s, ARPHRD_ETHER);
+ NetworkStackUtils.attachControlPacketFilter(s, ARPHRD_ETHER);
Os.bind(s, makePacketSocketAddress((short) ETH_P_ALL, mInterface.index));
} catch (ErrnoException | IOException e) {
logError("Failed to create packet tracking socket: ", e);
diff --git a/packages/NetworkStack/src/android/net/ip/IpClient.java b/packages/NetworkStack/src/android/net/ip/IpClient.java
index c1f178a..80d139c 100644
--- a/packages/NetworkStack/src/android/net/ip/IpClient.java
+++ b/packages/NetworkStack/src/android/net/ip/IpClient.java
@@ -51,6 +51,7 @@
import android.text.TextUtils;
import android.util.LocalLog;
import android.util.Log;
+import android.util.Pair;
import android.util.SparseArray;
import com.android.internal.annotations.VisibleForTesting;
@@ -298,6 +299,7 @@
private static final int EVENT_READ_PACKET_FILTER_COMPLETE = 12;
private static final int CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF = 13;
private static final int CMD_REMOVE_KEEPALIVE_PACKET_FILTER_FROM_APF = 14;
+ private static final int CMD_UPDATE_L2KEY_GROUPHINT = 15;
// Internal commands to use instead of trying to call transitionTo() inside
// a given State's enter() method. Calling transitionTo() from enter/exit
@@ -364,6 +366,8 @@
private String mTcpBufferSizes;
private ProxyInfo mHttpProxy;
private ApfFilter mApfFilter;
+ private String mL2Key; // The L2 key for this network, for writing into the memory store
+ private String mGroupHint; // The group hint for this network, for writing into the memory store
private boolean mMulticastFiltering;
private long mStartTimeMillis;
@@ -524,6 +528,11 @@
IpClient.this.stop();
}
@Override
+ public void setL2KeyAndGroupHint(String l2Key, String groupHint) {
+ checkNetworkStackCallingPermission();
+ IpClient.this.setL2KeyAndGroupHint(l2Key, groupHint);
+ }
+ @Override
public void setTcpBufferSizes(String tcpBufferSizes) {
checkNetworkStackCallingPermission();
IpClient.this.setTcpBufferSizes(tcpBufferSizes);
@@ -652,6 +661,13 @@
}
/**
+ * Set the L2 key and group hint for storing info into the memory store.
+ */
+ public void setL2KeyAndGroupHint(String l2Key, String groupHint) {
+ sendMessage(CMD_UPDATE_L2KEY_GROUPHINT, new Pair<>(l2Key, groupHint));
+ }
+
+ /**
* Set the HTTP Proxy configuration to use.
*
* This may be called, repeatedly, at any time before or after a call to
@@ -1068,6 +1084,10 @@
return true;
}
final int delta = setLinkProperties(newLp);
+ // Most of the attributes stored in the memory store are deduced from
+ // the link properties, therefore when the properties update the memory
+ // store record should be updated too.
+ maybeSaveNetworkToIpMemoryStore();
if (sendCallbacks) {
dispatchCallback(delta, newLp);
}
@@ -1083,6 +1103,7 @@
Log.d(mTag, "onNewDhcpResults(" + Objects.toString(dhcpResults) + ")");
}
mCallback.onNewDhcpResults(dhcpResults);
+ maybeSaveNetworkToIpMemoryStore();
dispatchCallback(delta, newLp);
}
@@ -1213,6 +1234,10 @@
mInterfaceCtrl.clearAllAddresses();
}
+ private void maybeSaveNetworkToIpMemoryStore() {
+ // TODO : implement this
+ }
+
class StoppedState extends State {
@Override
public void enter() {
@@ -1258,6 +1283,13 @@
handleLinkPropertiesUpdate(NO_CALLBACKS);
break;
+ case CMD_UPDATE_L2KEY_GROUPHINT: {
+ final Pair<String, String> args = (Pair<String, String>) msg.obj;
+ mL2Key = args.first;
+ mGroupHint = args.second;
+ break;
+ }
+
case CMD_SET_MULTICAST_FILTER:
mMulticastFiltering = (boolean) msg.obj;
break;
@@ -1357,6 +1389,20 @@
}
break;
+ case CMD_UPDATE_L2KEY_GROUPHINT: {
+ final Pair<String, String> args = (Pair<String, String>) msg.obj;
+ mL2Key = args.first;
+ mGroupHint = args.second;
+ // TODO : attributes should be saved to the memory store with
+ // these new values if they differ from the previous ones.
+ // If the state machine is in pure StartedState, then the values to input
+ // are not known yet and should be updated when the LinkProperties are updated.
+ // If the state machine is in RunningState (which is a child of StartedState)
+ // then the next NUD check should be used to store the new values to avoid
+ // inputting current values for what may be a different L3 network.
+ break;
+ }
+
case EVENT_PROVISIONING_TIMEOUT:
handleProvisioningFailure();
break;
diff --git a/packages/NetworkStack/src/android/net/util/NetworkStackUtils.java b/packages/NetworkStack/src/android/net/util/NetworkStackUtils.java
index 670563c..ee83a85 100644
--- a/packages/NetworkStack/src/android/net/util/NetworkStackUtils.java
+++ b/packages/NetworkStack/src/android/net/util/NetworkStackUtils.java
@@ -22,14 +22,18 @@
import java.io.FileDescriptor;
import java.io.IOException;
+import java.net.Inet4Address;
+import java.net.SocketException;
import java.util.List;
import java.util.function.Predicate;
-
/**
* Collection of utilities for the network stack.
*/
public class NetworkStackUtils {
+ static {
+ System.loadLibrary("networkstackutilsjni");
+ }
/**
* @return True if the array is null or 0-length.
@@ -97,4 +101,39 @@
// TODO: Link to DeviceConfig API once it is ready.
return defaultValue;
}
+
+ /**
+ * Attaches a socket filter that accepts DHCP packets to the given socket.
+ */
+ public static native void attachDhcpFilter(FileDescriptor fd) throws SocketException;
+
+ /**
+ * Attaches a socket filter that accepts ICMPv6 router advertisements to the given socket.
+ * @param fd the socket's {@link FileDescriptor}.
+ * @param packetType the hardware address type, one of ARPHRD_*.
+ */
+ public static native void attachRaFilter(FileDescriptor fd, int packetType)
+ throws SocketException;
+
+ /**
+ * Attaches a socket filter that accepts L2-L4 signaling traffic required for IP connectivity.
+ *
+ * This includes: all ARP, ICMPv6 RS/RA/NS/NA messages, and DHCPv4 exchanges.
+ *
+ * @param fd the socket's {@link FileDescriptor}.
+ * @param packetType the hardware address type, one of ARPHRD_*.
+ */
+ public static native void attachControlPacketFilter(FileDescriptor fd, int packetType)
+ throws SocketException;
+
+ /**
+ * Add an entry into the ARP cache.
+ */
+ public static void addArpEntry(Inet4Address ipv4Addr, android.net.MacAddress ethAddr,
+ String ifname, FileDescriptor fd) throws IOException {
+ addArpEntry(ethAddr.toByteArray(), ipv4Addr.getAddress(), ifname, fd);
+ }
+
+ private static native void addArpEntry(byte[] ethAddr, byte[] netAddr, String ifname,
+ FileDescriptor fd) throws IOException;
}
diff --git a/packages/NetworkStack/tests/Android.bp b/packages/NetworkStack/tests/Android.bp
index aadf99e..424cd1f 100644
--- a/packages/NetworkStack/tests/Android.bp
+++ b/packages/NetworkStack/tests/Android.bp
@@ -42,6 +42,7 @@
"libbinder",
"libbinderthreadstate",
"libc++",
+ "libcgrouprc",
"libcrypto",
"libcutils",
"libdexfile",
@@ -54,6 +55,7 @@
"liblzma",
"libnativehelper",
"libnetworkstacktestsjni",
+ "libnetworkstackutilsjni",
"libpackagelistparser",
"libpcre2",
"libprocessgroup",
diff --git a/packages/NetworkStack/tests/src/android/net/ip/IpClientTest.java b/packages/NetworkStack/tests/src/android/net/ip/IpClientTest.java
index eee12d6..5f80006 100644
--- a/packages/NetworkStack/tests/src/android/net/ip/IpClientTest.java
+++ b/packages/NetworkStack/tests/src/android/net/ip/IpClientTest.java
@@ -28,6 +28,7 @@
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import android.app.AlarmManager;
@@ -40,7 +41,9 @@
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.MacAddress;
+import android.net.NetworkStackIpMemoryStore;
import android.net.RouteInfo;
+import android.net.ipmemorystore.NetworkAttributes;
import android.net.shared.InitialConfiguration;
import android.net.shared.ProvisioningConfiguration;
import android.net.util.InterfaceParams;
@@ -81,6 +84,8 @@
// See RFC 7042#section-2.1.2 for EUI-48 documentation values.
private static final MacAddress TEST_MAC = MacAddress.fromString("00:00:5E:00:53:01");
private static final int TEST_TIMEOUT_MS = 400;
+ private static final String TEST_L2KEY = "some l2key";
+ private static final String TEST_GROUPHINT = "some grouphint";
@Mock private Context mContext;
@Mock private ConnectivityManager mCm;
@@ -92,6 +97,7 @@
@Mock private IpClient.Dependencies mDependencies;
@Mock private ContentResolver mContentResolver;
@Mock private NetworkStackService.NetworkStackServiceManager mNetworkStackServiceManager;
+ @Mock private NetworkStackIpMemoryStore mIpMemoryStore;
private NetworkObserver mObserver;
private InterfaceParams mIfParams;
@@ -141,6 +147,12 @@
return empty;
}
+ private void verifyNetworkAttributesStored(final String l2Key,
+ final NetworkAttributes attributes) {
+ // TODO : when storing is implemented, turn this on
+ // verify(mIpMemoryStore).storeNetworkAttributes(eq(l2Key), eq(attributes), any());
+ }
+
@Test
public void testNullInterfaceNameMostDefinitelyThrows() throws Exception {
setTestInterfaceParams(null);
@@ -173,6 +185,7 @@
setTestInterfaceParams(TEST_IFNAME);
final IpClient ipc = new IpClient(mContext, TEST_IFNAME, mCb, mObserverRegistry,
mNetworkStackServiceManager, mDependencies);
+ verifyNoMoreInteractions(mIpMemoryStore);
ipc.shutdown();
}
@@ -183,6 +196,7 @@
mNetworkStackServiceManager, mDependencies);
ipc.startProvisioning(new ProvisioningConfiguration());
verify(mCb, times(1)).onProvisioningFailure(any());
+ verify(mIpMemoryStore, never()).storeNetworkAttributes(any(), any(), any());
ipc.shutdown();
}
@@ -202,6 +216,7 @@
verify(mCb, times(1)).setNeighborDiscoveryOffload(true);
verify(mCb, timeout(TEST_TIMEOUT_MS).times(1)).setFallbackMulticastFilter(false);
verify(mCb, never()).onProvisioningFailure(any());
+ verify(mIpMemoryStore, never()).storeNetworkAttributes(any(), any(), any());
ipc.shutdown();
verify(mNetd, timeout(TEST_TIMEOUT_MS).times(1)).interfaceSetEnableIPv6(iface, false);
@@ -214,6 +229,8 @@
public void testProvisioningWithInitialConfiguration() throws Exception {
final String iface = TEST_IFNAME;
final IpClient ipc = makeIpClient(iface);
+ final String l2Key = TEST_L2KEY;
+ final String groupHint = TEST_GROUPHINT;
String[] addresses = {
"fe80::a4be:f92:e1f7:22d1/64",
@@ -232,6 +249,7 @@
verify(mCb, times(1)).setNeighborDiscoveryOffload(true);
verify(mCb, timeout(TEST_TIMEOUT_MS).times(1)).setFallbackMulticastFilter(false);
verify(mCb, never()).onProvisioningFailure(any());
+ ipc.setL2KeyAndGroupHint(l2Key, groupHint);
for (String addr : addresses) {
String[] parts = addr.split("/");
@@ -253,12 +271,16 @@
LinkProperties want = linkproperties(links(addresses), routes(prefixes));
want.setInterfaceName(iface);
verify(mCb, timeout(TEST_TIMEOUT_MS).times(1)).onProvisioningSuccess(want);
+ verifyNetworkAttributesStored(l2Key, new NetworkAttributes.Builder()
+ .setGroupHint(groupHint)
+ .build());
ipc.shutdown();
verify(mNetd, timeout(TEST_TIMEOUT_MS).times(1)).interfaceSetEnableIPv6(iface, false);
verify(mNetd, timeout(TEST_TIMEOUT_MS).times(1)).interfaceClearAddrs(iface);
verify(mCb, timeout(TEST_TIMEOUT_MS).times(1))
.onLinkPropertiesChange(makeEmptyLinkProperties(iface));
+ verifyNoMoreInteractions(mIpMemoryStore);
}
@Test
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index fc9d6f8..b786018 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -1761,16 +1761,17 @@
// the caller thread of registerNetworkAgent. Thus, it's not allowed to register netd
// event callback for certain nai. e.g. cellular. Register here to pass to
// NetworkMonitor instead.
- // TODO: Move the Dns Event to NetworkMonitor. Use Binder.clearCallingIdentity() in
- // registerNetworkAgent to have NetworkMonitor created with system process as design
- // expectation. Also, NetdEventListenerService only allow one callback from each
- // caller type. Need to re-factor NetdEventListenerService to allow multiple
- // NetworkMonitor registrants.
+ // TODO: Move the Dns Event to NetworkMonitor. NetdEventListenerService only allow one
+ // callback from each caller type. Need to re-factor NetdEventListenerService to allow
+ // multiple NetworkMonitor registrants.
if (nai != null && nai.satisfies(mDefaultRequest)) {
+ final long token = Binder.clearCallingIdentity();
try {
nai.networkMonitor().notifyDnsResponse(returnCode);
} catch (RemoteException e) {
e.rethrowFromSystemServer();
+ } finally {
+ Binder.restoreCallingIdentity(token);
}
}
}
diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java
index 126bf65..2cfcecc 100644
--- a/services/core/java/com/android/server/IpSecService.java
+++ b/services/core/java/com/android/server/IpSecService.java
@@ -96,9 +96,10 @@
new int[] {OsConstants.AF_INET, OsConstants.AF_INET6};
private static final int NETD_FETCH_TIMEOUT_MS = 5000; // ms
- private static final int MAX_PORT_BIND_ATTEMPTS = 10;
private static final InetAddress INADDR_ANY;
+ @VisibleForTesting static final int MAX_PORT_BIND_ATTEMPTS = 10;
+
static {
try {
INADDR_ANY = InetAddress.getByAddress(new byte[] {0, 0, 0, 0});
diff --git a/services/core/java/com/android/server/connectivity/PermissionMonitor.java b/services/core/java/com/android/server/connectivity/PermissionMonitor.java
index da1360d..b6946023 100644
--- a/services/core/java/com/android/server/connectivity/PermissionMonitor.java
+++ b/services/core/java/com/android/server/connectivity/PermissionMonitor.java
@@ -469,7 +469,10 @@
*/
@VisibleForTesting
void sendPackagePermissionsToNetd(SparseIntArray netdPermissionsAppIds) {
-
+ if (mNetd == null) {
+ Log.e(TAG, "Failed to get the netd service");
+ return;
+ }
ArrayList<Integer> allPermissionAppIds = new ArrayList<>();
ArrayList<Integer> internetPermissionAppIds = new ArrayList<>();
ArrayList<Integer> updateStatsPermissionAppIds = new ArrayList<>();
diff --git a/services/core/java/com/android/server/media/AudioPlayerStateMonitor.java b/services/core/java/com/android/server/media/AudioPlayerStateMonitor.java
index 648c782..603d7cf 100644
--- a/services/core/java/com/android/server/media/AudioPlayerStateMonitor.java
+++ b/services/core/java/com/android/server/media/AudioPlayerStateMonitor.java
@@ -18,14 +18,11 @@
import android.annotation.NonNull;
import android.content.Context;
+import android.media.AudioManager;
import android.media.AudioPlaybackConfiguration;
-import android.media.IAudioService;
-import android.media.IPlaybackConfigDispatcher;
-import android.os.Binder;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
-import android.os.RemoteException;
import android.os.UserHandle;
import android.util.ArrayMap;
import android.util.ArraySet;
@@ -42,11 +39,11 @@
/**
* Monitors the state changes of audio players.
*/
-class AudioPlayerStateMonitor extends IPlaybackConfigDispatcher.Stub {
+class AudioPlayerStateMonitor {
private static boolean DEBUG = MediaSessionService.DEBUG;
private static String TAG = "AudioPlayerStateMonitor";
- private static AudioPlayerStateMonitor sInstance = new AudioPlayerStateMonitor();
+ private static AudioPlayerStateMonitor sInstance;
/**
* Listener for handling the active state changes of audio players.
@@ -96,96 +93,33 @@
private final Map<OnAudioPlayerActiveStateChangedListener, MessageHandler> mListenerMap =
new ArrayMap<>();
@GuardedBy("mLock")
- private final Set<Integer> mActiveAudioUids = new ArraySet<>();
+ @SuppressWarnings("WeakerAccess") /* synthetic access */
+ final Set<Integer> mActiveAudioUids = new ArraySet<>();
@GuardedBy("mLock")
- private ArrayMap<Integer, AudioPlaybackConfiguration> mPrevActiveAudioPlaybackConfigs =
+ @SuppressWarnings("WeakerAccess") /* synthetic access */
+ ArrayMap<Integer, AudioPlaybackConfiguration> mPrevActiveAudioPlaybackConfigs =
new ArrayMap<>();
// Sorted array of UIDs that had active audio playback. (i.e. playing an audio/video)
// The UID whose audio playback becomes active at the last comes first.
// TODO(b/35278867): Find and use unique identifier for apps because apps may share the UID.
@GuardedBy("mLock")
- private final IntArray mSortedAudioPlaybackClientUids = new IntArray();
+ @SuppressWarnings("WeakerAccess") /* synthetic access */
+ final IntArray mSortedAudioPlaybackClientUids = new IntArray();
- @GuardedBy("mLock")
- private boolean mRegisteredToAudioService;
-
- static AudioPlayerStateMonitor getInstance() {
- return sInstance;
- }
-
- private AudioPlayerStateMonitor() {
- }
-
- /**
- * Called when the {@link AudioPlaybackConfiguration} is updated.
- * <p>If an app starts audio playback, the app's local media session will be the media button
- * session. If the app has multiple media sessions, the playback active local session will be
- * picked.
- *
- * @param configs List of the current audio playback configuration
- */
- @Override
- public void dispatchPlaybackConfigChange(List<AudioPlaybackConfiguration> configs,
- boolean flush) {
- if (flush) {
- Binder.flushPendingCommands();
- }
- final long token = Binder.clearCallingIdentity();
- try {
- synchronized (mLock) {
- // Update mActiveAudioUids
- mActiveAudioUids.clear();
- ArrayMap<Integer, AudioPlaybackConfiguration> activeAudioPlaybackConfigs =
- new ArrayMap<>();
- for (AudioPlaybackConfiguration config : configs) {
- if (config.isActive()) {
- mActiveAudioUids.add(config.getClientUid());
- activeAudioPlaybackConfigs.put(config.getPlayerInterfaceId(), config);
- }
- }
-
- // Update mSortedAuioPlaybackClientUids.
- for (int i = 0; i < activeAudioPlaybackConfigs.size(); ++i) {
- AudioPlaybackConfiguration config = activeAudioPlaybackConfigs.valueAt(i);
- final int uid = config.getClientUid();
- if (!mPrevActiveAudioPlaybackConfigs.containsKey(
- config.getPlayerInterfaceId())) {
- if (DEBUG) {
- Log.d(TAG, "Found a new active media playback. " +
- AudioPlaybackConfiguration.toLogFriendlyString(config));
- }
- // New active audio playback.
- int index = mSortedAudioPlaybackClientUids.indexOf(uid);
- if (index == 0) {
- // It's the lastly played music app already. Skip updating.
- continue;
- } else if (index > 0) {
- mSortedAudioPlaybackClientUids.remove(index);
- }
- mSortedAudioPlaybackClientUids.add(0, uid);
- }
- }
- // Notify the active state change of audio players.
- for (AudioPlaybackConfiguration config : configs) {
- final int pii = config.getPlayerInterfaceId();
- boolean wasActive = mPrevActiveAudioPlaybackConfigs.remove(pii) != null;
- if (wasActive != config.isActive()) {
- sendAudioPlayerActiveStateChangedMessageLocked(
- config, /* isRemoved */ false);
- }
- }
- for (AudioPlaybackConfiguration config : mPrevActiveAudioPlaybackConfigs.values()) {
- sendAudioPlayerActiveStateChangedMessageLocked(config, /* isRemoved */ true);
- }
-
- // Update mPrevActiveAudioPlaybackConfigs
- mPrevActiveAudioPlaybackConfigs = activeAudioPlaybackConfigs;
+ static AudioPlayerStateMonitor getInstance(Context context) {
+ synchronized (AudioPlayerStateMonitor.class) {
+ if (sInstance == null) {
+ sInstance = new AudioPlayerStateMonitor(context);
}
- } finally {
- Binder.restoreCallingIdentity(token);
+ return sInstance;
}
}
+ private AudioPlayerStateMonitor(Context context) {
+ AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+ am.registerAudioPlaybackCallback(new AudioManagerPlaybackListener(), null);
+ }
+
/**
* Registers OnAudioPlayerActiveStateChangedListener.
*/
@@ -275,20 +209,6 @@
}
}
- public void registerSelfIntoAudioServiceIfNeeded(IAudioService audioService) {
- synchronized (mLock) {
- try {
- if (!mRegisteredToAudioService) {
- audioService.registerPlaybackCallback(this);
- mRegisteredToAudioService = true;
- }
- } catch (RemoteException e) {
- Log.wtf(TAG, "Failed to register playback callback", e);
- mRegisteredToAudioService = false;
- }
- }
- }
-
@GuardedBy("mLock")
private void sendAudioPlayerActiveStateChangedMessageLocked(
final AudioPlaybackConfiguration config, final boolean isRemoved) {
@@ -296,4 +216,59 @@
messageHandler.sendAudioPlayerActiveStateChangedMessage(config, isRemoved);
}
}
+
+ private class AudioManagerPlaybackListener extends AudioManager.AudioPlaybackCallback {
+ @Override
+ public void onPlaybackConfigChanged(List<AudioPlaybackConfiguration> configs) {
+ synchronized (mLock) {
+ // Update mActiveAudioUids
+ mActiveAudioUids.clear();
+ ArrayMap<Integer, AudioPlaybackConfiguration> activeAudioPlaybackConfigs =
+ new ArrayMap<>();
+ for (AudioPlaybackConfiguration config : configs) {
+ if (config.isActive()) {
+ mActiveAudioUids.add(config.getClientUid());
+ activeAudioPlaybackConfigs.put(config.getPlayerInterfaceId(), config);
+ }
+ }
+
+ // Update mSortedAuioPlaybackClientUids.
+ for (int i = 0; i < activeAudioPlaybackConfigs.size(); ++i) {
+ AudioPlaybackConfiguration config = activeAudioPlaybackConfigs.valueAt(i);
+ final int uid = config.getClientUid();
+ if (!mPrevActiveAudioPlaybackConfigs.containsKey(
+ config.getPlayerInterfaceId())) {
+ if (DEBUG) {
+ Log.d(TAG, "Found a new active media playback. "
+ + AudioPlaybackConfiguration.toLogFriendlyString(config));
+ }
+ // New active audio playback.
+ int index = mSortedAudioPlaybackClientUids.indexOf(uid);
+ if (index == 0) {
+ // It's the lastly played music app already. Skip updating.
+ continue;
+ } else if (index > 0) {
+ mSortedAudioPlaybackClientUids.remove(index);
+ }
+ mSortedAudioPlaybackClientUids.add(0, uid);
+ }
+ }
+ // Notify the active state change of audio players.
+ for (AudioPlaybackConfiguration config : configs) {
+ final int pii = config.getPlayerInterfaceId();
+ boolean wasActive = mPrevActiveAudioPlaybackConfigs.remove(pii) != null;
+ if (wasActive != config.isActive()) {
+ sendAudioPlayerActiveStateChangedMessageLocked(
+ config, /* isRemoved */ false);
+ }
+ }
+ for (AudioPlaybackConfiguration config : mPrevActiveAudioPlaybackConfigs.values()) {
+ sendAudioPlayerActiveStateChangedMessageLocked(config, /* isRemoved */ true);
+ }
+
+ // Update mPrevActiveAudioPlaybackConfigs
+ mPrevActiveAudioPlaybackConfigs = activeAudioPlaybackConfigs;
+ }
+ }
+ }
}
diff --git a/services/core/java/com/android/server/media/MediaRouterService.java b/services/core/java/com/android/server/media/MediaRouterService.java
index a7df0e2..47f2270 100644
--- a/services/core/java/com/android/server/media/MediaRouterService.java
+++ b/services/core/java/com/android/server/media/MediaRouterService.java
@@ -16,14 +16,10 @@
package com.android.server.media;
-import com.android.internal.util.DumpUtils;
-import com.android.server.Watchdog;
-
import android.annotation.NonNull;
import android.app.ActivityManager;
import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothProfile;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -57,6 +53,9 @@
import android.util.SparseArray;
import android.util.TimeUtils;
+import com.android.internal.util.DumpUtils;
+import com.android.server.Watchdog;
+
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -115,7 +114,7 @@
mAudioService = IAudioService.Stub.asInterface(
ServiceManager.getService(Context.AUDIO_SERVICE));
- mAudioPlayerStateMonitor = AudioPlayerStateMonitor.getInstance();
+ mAudioPlayerStateMonitor = AudioPlayerStateMonitor.getInstance(context);
mAudioPlayerStateMonitor.registerListener(
new AudioPlayerStateMonitor.OnAudioPlayerActiveStateChangedListener() {
static final long WAIT_MS = 500;
@@ -166,7 +165,6 @@
}
}
}, mHandler);
- mAudioPlayerStateMonitor.registerSelfIntoAudioServiceIfNeeded(mAudioService);
AudioRoutesInfo audioRoutes = null;
try {
diff --git a/services/core/java/com/android/server/media/MediaSessionRecord.java b/services/core/java/com/android/server/media/MediaSessionRecord.java
index 442354b..29529b8 100644
--- a/services/core/java/com/android/server/media/MediaSessionRecord.java
+++ b/services/core/java/com/android/server/media/MediaSessionRecord.java
@@ -669,6 +669,9 @@
PlaybackState state;
long duration = -1;
synchronized (mLock) {
+ if (mDestroyed) {
+ return null;
+ }
state = mPlaybackState;
if (mMetadata != null && mMetadata.containsKey(MediaMetadata.METADATA_KEY_DURATION)) {
duration = mMetadata.getLong(MediaMetadata.METADATA_KEY_DURATION);
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java
index 68b2a58..67f605c 100644
--- a/services/core/java/com/android/server/media/MediaSessionService.java
+++ b/services/core/java/com/android/server/media/MediaSessionService.java
@@ -93,8 +93,8 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.NoSuchElementException;
+import java.util.Set;
/**
* System implementation of MediaSessionManager
@@ -164,7 +164,7 @@
mKeyguardManager =
(KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
mAudioService = getAudioService();
- mAudioPlayerStateMonitor = AudioPlayerStateMonitor.getInstance();
+ mAudioPlayerStateMonitor = AudioPlayerStateMonitor.getInstance(getContext());
mAudioPlayerStateMonitor.registerListener(
(config, isRemoved) -> {
if (isRemoved || !config.isActive() || config.getPlayerType()
@@ -179,7 +179,6 @@
}
}
}, null /* handler */);
- mAudioPlayerStateMonitor.registerSelfIntoAudioServiceIfNeeded(mAudioService);
mContentResolver = getContext().getContentResolver();
mSettingsObserver = new SettingsObserver();
mSettingsObserver.observe();
diff --git a/services/core/xsd/vts/Android.bp b/services/core/xsd/vts/Android.bp
new file mode 100644
index 0000000..967750d
--- /dev/null
+++ b/services/core/xsd/vts/Android.bp
@@ -0,0 +1,33 @@
+//
+// 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.
+//
+
+cc_test {
+ name: "vts_defaultPermissions_validate_test",
+ srcs: [
+ "ValidateDefaultPermissions.cpp"
+ ],
+ static_libs: [
+ "android.hardware.audio.common.test.utility",
+ "libxml2",
+ ],
+ shared_libs: [
+ "liblog",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+}
diff --git a/location/Android.mk b/services/core/xsd/vts/Android.mk
similarity index 76%
copy from location/Android.mk
copy to services/core/xsd/vts/Android.mk
index 50509c6..6dc2c43 100644
--- a/location/Android.mk
+++ b/services/core/xsd/vts/Android.mk
@@ -1,4 +1,5 @@
-# Copyright (C) 2010 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.
@@ -11,7 +12,11 @@
# 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.
+#
LOCAL_PATH := $(call my-dir)
-include $(call all-subdir-makefiles, $(LOCAL_PATH))
\ No newline at end of file
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := VtsValidateDefaultPermissions
+include test/vts/tools/build/Android.host_config.mk
diff --git a/services/core/xsd/vts/AndroidTest.xml b/services/core/xsd/vts/AndroidTest.xml
new file mode 100644
index 0000000..4f3b2ef
--- /dev/null
+++ b/services/core/xsd/vts/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Config for VTS VtsValidateDefaultPermissions.">
+ <option name="config-descriptor:metadata" key="plan" value="vts-treble" />
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+ <option name="abort-on-push-failure" value="false"/>
+ <option name="push-group" value="HostDrivenTest.push"/>
+ <option name="push" value="DATA/etc/default-permissions.xsd->/data/local/tmp/default-permissions.xsd"/>
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+ <option name="test-module-name" value="VtsValidateDefaultPermissions"/>
+ <option name="binary-test-source" value="_32bit::DATA/nativetest/vts_defaultPermissions_validate_test/vts_defaultPermissions_validate_test" />
+ <option name="binary-test-source" value="_64bit::DATA/nativetest64/vts_defaultPermissions_validate_test/vts_defaultPermissions_validate_test" />
+ <option name="binary-test-type" value="gtest"/>
+ <option name="test-timeout" value="30s"/>
+ </test>
+</configuration>
diff --git a/services/core/xsd/vts/ValidateDefaultPermissions.cpp b/services/core/xsd/vts/ValidateDefaultPermissions.cpp
new file mode 100644
index 0000000..54c115b
--- /dev/null
+++ b/services/core/xsd/vts/ValidateDefaultPermissions.cpp
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+#include "utility/ValidateXml.h"
+
+TEST(CheckConfig, mediaDefaultPermissions) {
+ RecordProperty("description",
+ "Verify that the default-permissions file "
+ "is valid according to the schema");
+
+ const char* location = "/vendor/etc/default-permissions";
+
+ EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("default-permissions.xml", {location},
+ "/data/local/tmp/default-permissions.xsd");
+}
diff --git a/services/net/java/android/net/ip/IIpClient.aidl b/services/net/java/android/net/ip/IIpClient.aidl
index b834e45..e1fe9e5 100644
--- a/services/net/java/android/net/ip/IIpClient.aidl
+++ b/services/net/java/android/net/ip/IIpClient.aidl
@@ -27,6 +27,7 @@
void shutdown();
void startProvisioning(in ProvisioningConfigurationParcelable req);
void stop();
+ void setL2KeyAndGroupHint(in String l2Key, in String groupHint);
void setTcpBufferSizes(in String tcpBufferSizes);
void setHttpProxy(in ProxyInfo proxyInfo);
void setMulticastFilter(boolean enabled);
diff --git a/services/net/java/android/net/netlink/NetlinkSocket.java b/services/net/java/android/net/netlink/NetlinkSocket.java
index 4240d24..7311fc5 100644
--- a/services/net/java/android/net/netlink/NetlinkSocket.java
+++ b/services/net/java/android/net/netlink/NetlinkSocket.java
@@ -30,6 +30,7 @@
import android.net.util.SocketUtils;
import android.system.ErrnoException;
import android.system.Os;
+import android.system.StructTimeval;
import android.util.Log;
import java.io.FileDescriptor;
@@ -128,7 +129,7 @@
throws ErrnoException, IllegalArgumentException, InterruptedIOException {
checkTimeout(timeoutMs);
- SocketUtils.setSocketTimeValueOption(fd, SOL_SOCKET, SO_RCVTIMEO, timeoutMs);
+ Os.setsockoptTimeval(fd, SOL_SOCKET, SO_RCVTIMEO, StructTimeval.fromMillis(timeoutMs));
ByteBuffer byteBuffer = ByteBuffer.allocate(bufsize);
int length = Os.read(fd, byteBuffer);
@@ -151,7 +152,7 @@
FileDescriptor fd, byte[] bytes, int offset, int count, long timeoutMs)
throws ErrnoException, IllegalArgumentException, InterruptedIOException {
checkTimeout(timeoutMs);
- SocketUtils.setSocketTimeValueOption(fd, SOL_SOCKET, SO_SNDTIMEO, timeoutMs);
+ Os.setsockoptTimeval(fd, SOL_SOCKET, SO_SNDTIMEO, StructTimeval.fromMillis(timeoutMs));
return Os.write(fd, bytes, offset, count);
}
}
diff --git a/startop/iorap/tests/Android.bp b/startop/iorap/tests/Android.bp
index 7605784..2b810f3 100644
--- a/startop/iorap/tests/Android.bp
+++ b/startop/iorap/tests/Android.bp
@@ -16,7 +16,6 @@
java_library {
name: "libiorap-java-test-lib",
srcs: ["src/**/*.kt"],
-
static_libs: [
// non-test dependencies
"libiorap-java",
@@ -28,13 +27,33 @@
// "mockito-target-minus-junit4",
// Mockito also requires JNI (see Android.mk)
// and android:debuggable=true (see AndroidManifest.xml)
- "truth-prebuilt",
+ "truth-prebuilt",
],
-
// sdk_version: "current",
// certificate: "platform",
-
- libs: ["android.test.base", "android.test.runner"],
-
+ libs: [
+ "android.test.base",
+ "android.test.runner",
+ ],
// test_suites: ["device-tests"],
}
+
+android_test {
+ name: "libiorap-java-tests",
+ dxflags: ["--multi-dex"],
+ test_suites: ["device-tests"],
+ static_libs: ["libiorap-java-test-lib"],
+ compile_multilib: "both",
+ jni_libs: [
+ "libdexmakerjvmtiagent",
+ "libstaticjvmtiagent",
+ "libmultiplejvmtiagentsinterferenceagent",
+ ],
+ libs: [
+ "android.test.base",
+ "android.test.runner",
+ ],
+ // Use private APIs
+ certificate: "platform",
+ platform_apis: true,
+}
diff --git a/startop/iorap/tests/Android.mk b/startop/iorap/tests/Android.mk
deleted file mode 100644
index 1b2aa46..0000000
--- a/startop/iorap/tests/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (C) 2018 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# android_test does not support JNI libraries
-# TODO: once b/80095087 is fixed, rewrite this back to android_test
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JACK_FLAGS := --multi-dex native
-LOCAL_DX_FLAGS := --multi-dex
-
-LOCAL_PACKAGE_NAME := libiorap-java-tests
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- libiorap-java-test-lib
-
-LOCAL_MULTILIB := both
-
-LOCAL_JNI_SHARED_LIBRARIES := \
- libdexmakerjvmtiagent \
- libstaticjvmtiagent \
- libmultiplejvmtiagentsinterferenceagent
-
-LOCAL_JAVA_LIBRARIES := \
- android.test.base \
- android.test.runner
-
-# Use private APIs
-LOCAL_CERTIFICATE := platform
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index dcaa499..9adeea0 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -542,7 +542,6 @@
private final Bundle mExtras;
private final Bundle mIntentExtras;
private final long mCreationTimeMillis;
- private final CallIdentification mCallIdentification;
private final @CallDirection int mCallDirection;
/**
@@ -728,8 +727,6 @@
* The display name for the caller.
* <p>
* This is the name as reported by the {@link ConnectionService} associated with this call.
- * The name reported by a {@link CallScreeningService} can be retrieved using
- * {@link CallIdentification#getName()}.
*
* @return The display name for the caller.
*/
@@ -847,23 +844,6 @@
}
/**
- * Returns {@link CallIdentification} information provided by a
- * {@link CallScreeningService} for this call.
- * <p>
- * {@link InCallService} implementations should display the {@link CallIdentification} for
- * calls. The name of the call screening service is provided in
- * {@link CallIdentification#getCallScreeningAppName()} and should be used to attribute the
- * call identification information.
- *
- * @return The {@link CallIdentification} if it was provided by a
- * {@link CallScreeningService}, or {@code null} if no {@link CallScreeningService} has
- * provided {@link CallIdentification} information for the call.
- */
- public @Nullable CallIdentification getCallIdentification() {
- return mCallIdentification;
- }
-
- /**
* Indicates whether the call is an incoming or outgoing call.
* @return The call's direction.
*/
@@ -892,7 +872,6 @@
areBundlesEqual(mExtras, d.mExtras) &&
areBundlesEqual(mIntentExtras, d.mIntentExtras) &&
Objects.equals(mCreationTimeMillis, d.mCreationTimeMillis) &&
- Objects.equals(mCallIdentification, d.mCallIdentification) &&
Objects.equals(mCallDirection, d.mCallDirection);
}
return false;
@@ -915,7 +894,6 @@
mExtras,
mIntentExtras,
mCreationTimeMillis,
- mCallIdentification,
mCallDirection);
}
@@ -937,7 +915,6 @@
Bundle extras,
Bundle intentExtras,
long creationTimeMillis,
- CallIdentification callIdentification,
int callDirection) {
mTelecomCallId = telecomCallId;
mHandle = handle;
@@ -955,7 +932,6 @@
mExtras = extras;
mIntentExtras = intentExtras;
mCreationTimeMillis = creationTimeMillis;
- mCallIdentification = callIdentification;
mCallDirection = callDirection;
}
@@ -978,7 +954,6 @@
parcelableCall.getExtras(),
parcelableCall.getIntentExtras(),
parcelableCall.getCreationTimeMillis(),
- parcelableCall.getCallIdentification(),
parcelableCall.getCallDirection());
}
diff --git a/telecomm/java/android/telecom/CallIdentification.aidl b/telecomm/java/android/telecom/CallIdentification.aidl
deleted file mode 100644
index 532535c..0000000
--- a/telecomm/java/android/telecom/CallIdentification.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2018, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telecom;
-
-/**
- * {@hide}
- */
-parcelable CallIdentification;
diff --git a/telecomm/java/android/telecom/CallIdentification.java b/telecomm/java/android/telecom/CallIdentification.java
deleted file mode 100644
index fffc123..0000000
--- a/telecomm/java/android/telecom/CallIdentification.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telecom;
-
-import android.annotation.IntDef;
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.content.pm.ApplicationInfo;
-import android.graphics.drawable.Icon;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.Objects;
-
-/**
- * Encapsulates information about an incoming or outgoing {@link Call} provided by a
- * {@link CallScreeningService}.
- * <p>
- * Call identified information is consumed by the {@link InCallService dialer} app to provide the
- * user with more information about a call. This can include information such as the name of the
- * caller, address, etc. Call identification information is persisted to the
- * {@link android.provider.CallLog}.
- */
-public final class CallIdentification implements Parcelable {
- /**
- * Builder for {@link CallIdentification} instances.
- * <p>
- * A {@link CallScreeningService} uses this class to create new instances of
- * {@link CallIdentification} for a screened call.
- */
- public final static class Builder {
- private CharSequence mName;
- private CharSequence mDescription;
- private CharSequence mDetails;
- private Icon mPhoto;
- private int mNuisanceConfidence = CallIdentification.CONFIDENCE_UNKNOWN;
- private String mPackageName;
- private CharSequence mAppName;
-
- /**
- * Default builder constructor.
- */
- public Builder() {
- // Default constructor
- }
-
- /**
- * Create instance of call identification with specified package/app name.
- *
- * @param callIdPackageName The package name.
- * @param callIdAppName The app name.
- * @hide
- */
- public Builder(@NonNull String callIdPackageName, @NonNull CharSequence callIdAppName) {
- mPackageName = callIdPackageName;
- mAppName = callIdAppName;
- }
-
- /**
- * Sets the name associated with the {@link CallIdentification} being built.
- * <p>
- * Could be a business name, for example.
- *
- * @param name The name associated with the call, or {@code null} if none is provided.
- * @return Builder instance.
- */
- public @NonNull Builder setName(@Nullable CharSequence name) {
- mName = name;
- return this;
- }
-
- /**
- * Sets the description associated with the {@link CallIdentification} being built.
- * <p>
- * A description of the call as identified by a {@link CallScreeningService}. The
- * description is typically presented by Dialer apps after the
- * {@link CallIdentification#getName() name} to provide a short piece of relevant
- * information about the call. This could include a location, address, or a message
- * regarding the potential nature of the call (e.g. potential telemarketer).
- *
- * @param description The call description, or {@code null} if none is provided.
- * @return Builder instance.
- */
- public @NonNull Builder setDescription(@Nullable CharSequence description) {
- mDescription = description;
- return this;
- }
-
- /**
- * Sets the details associated with the {@link CallIdentification} being built.
- * <p>
- * The details is typically presented by Dialer apps after the
- * {@link CallIdentification#getName() name} and
- * {@link CallIdentification#getDescription() description} to provide further clarifying
- * information about the call. This could include, for example, the opening hours of a
- * business, or a stats about the number of times a call has been reported as spam.
- *
- * @param details The call details, or {@code null} if none is provided.
- * @return Builder instance.
- */
-
- public @NonNull Builder setDetails(@Nullable CharSequence details) {
- mDetails = details;
- return this;
- }
-
- /**
- * Sets the photo associated with the {@link CallIdentification} being built.
- * <p>
- * This could be, for example, a business logo, or a photo of the caller.
- *
- * @param photo The photo associated with the call, or {@code null} if none was provided.
- * @return Builder instance.
- */
- public @NonNull Builder setPhoto(@Nullable Icon photo) {
- mPhoto = photo;
- return this;
- }
-
- /**
- * Sets the nuisance confidence with the {@link CallIdentification} being built.
- * <p>
- * This can be used to specify how confident the {@link CallScreeningService} is that a call
- * is or is not a nuisance call.
- *
- * @param nuisanceConfidence The nuisance confidence.
- * @return The builder.
- */
- public @NonNull Builder setNuisanceConfidence(@NuisanceConfidence int nuisanceConfidence) {
- mNuisanceConfidence = nuisanceConfidence;
- return this;
- }
-
- /**
- * Creates a new instance of {@link CallIdentification} based on the parameters set in this
- * builder.
- *
- * @return {@link CallIdentification} instance.
- */
- public @NonNull CallIdentification build() {
- return new CallIdentification(mName, mDescription, mDetails, mPhoto,
- mNuisanceConfidence, mPackageName, mAppName);
- }
- }
-
- /** @hide */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef(
- prefix = { "CONFIDENCE_" },
- value = {CONFIDENCE_NUISANCE, CONFIDENCE_LIKELY_NUISANCE, CONFIDENCE_UNKNOWN,
- CONFIDENCE_LIKELY_NOT_NUISANCE, CONFIDENCE_NOT_NUISANCE})
- public @interface NuisanceConfidence {}
-
- /**
- * Call has been identified as a nuisance call.
- * <p>
- * Returned from {@link #getNuisanceConfidence()} to indicate that a
- * {@link CallScreeningService} to indicate how confident it is that a call is or is not a
- * nuisance call.
- */
- public static final int CONFIDENCE_NUISANCE = 2;
-
- /**
- * Call has been identified as a likely nuisance call.
- * <p>
- * Returned from {@link #getNuisanceConfidence()} to indicate that a
- * {@link CallScreeningService} to indicate how confident it is that a call is or is not a
- * nuisance call.
- */
- public static final int CONFIDENCE_LIKELY_NUISANCE = 1;
-
- /**
- * Call could not be classified as nuisance or non-nuisance.
- * <p>
- * Returned from {@link #getNuisanceConfidence()} to indicate that a
- * {@link CallScreeningService} to indicate how confident it is that a call is or is not a
- * nuisance call.
- */
- public static final int CONFIDENCE_UNKNOWN = 0;
-
- /**
- * Call has been identified as not likely to be a nuisance call.
- * <p>
- * Returned from {@link #getNuisanceConfidence()} to indicate that a
- * {@link CallScreeningService} to indicate how confident it is that a call is or is not a
- * nuisance call.
- */
- public static final int CONFIDENCE_LIKELY_NOT_NUISANCE = -1;
-
- /**
- * Call has been identified as not a nuisance call.
- * <p>
- * Returned from {@link #getNuisanceConfidence()} to indicate that a
- * {@link CallScreeningService} to indicate how confident it is that a call is or is not a
- * nuisance call.
- */
- public static final int CONFIDENCE_NOT_NUISANCE = -2;
-
- /**
- * Default constructor for {@link CallIdentification}.
- *
- * @param name The name.
- * @param description The description.
- * @param details The details.
- * @param photo The photo.
- * @param nuisanceConfidence Confidence that this is a nuisance call.
- * @hide
- */
- private CallIdentification(@Nullable String name, @Nullable String description,
- @Nullable String details, @Nullable Icon photo,
- @NuisanceConfidence int nuisanceConfidence) {
- this(name, description, details, photo, nuisanceConfidence, null, null);
- }
-
- /**
- * Default constructor for {@link CallIdentification}.
- *
- * @param name The name.
- * @param description The description.
- * @param details The details.
- * @param photo The photo.
- * @param nuisanceConfidence Confidence that this is a nuisance call.
- * @param callScreeningPackageName Package name of the {@link CallScreeningService} which
- * provided the call identification.
- * @param callScreeningAppName App name of the {@link CallScreeningService} which provided the
- * call identification.
- * @hide
- */
- private CallIdentification(@Nullable CharSequence name, @Nullable CharSequence description,
- @Nullable CharSequence details, @Nullable Icon photo,
- @NuisanceConfidence int nuisanceConfidence, @NonNull String callScreeningPackageName,
- @NonNull CharSequence callScreeningAppName) {
- mName = name;
- mDescription = description;
- mDetails = details;
- mPhoto = photo;
- mNuisanceConfidence = nuisanceConfidence;
- mCallScreeningAppName = callScreeningAppName;
- mCallScreeningPackageName = callScreeningPackageName;
- }
-
- private CharSequence mName;
- private CharSequence mDescription;
- private CharSequence mDetails;
- private Icon mPhoto;
- private int mNuisanceConfidence;
- private String mCallScreeningPackageName;
- private CharSequence mCallScreeningAppName;
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel parcel, int i) {
- parcel.writeCharSequence(mName);
- parcel.writeCharSequence(mDescription);
- parcel.writeCharSequence(mDetails);
- parcel.writeParcelable(mPhoto, 0);
- parcel.writeInt(mNuisanceConfidence);
- parcel.writeString(mCallScreeningPackageName);
- parcel.writeCharSequence(mCallScreeningAppName);
- }
-
- /**
- * Responsible for creating CallIdentification objects for deserialized Parcels.
- */
- public static final Parcelable.Creator<CallIdentification> CREATOR =
- new Parcelable.Creator<CallIdentification> () {
-
- @Override
- public CallIdentification createFromParcel(Parcel source) {
- CharSequence name = source.readCharSequence();
- CharSequence description = source.readCharSequence();
- CharSequence details = source.readCharSequence();
- Icon photo = source.readParcelable(ClassLoader.getSystemClassLoader());
- int nuisanceConfidence = source.readInt();
- String callScreeningPackageName = source.readString();
- CharSequence callScreeningAppName = source.readCharSequence();
- return new CallIdentification(name, description, details, photo,
- nuisanceConfidence, callScreeningPackageName, callScreeningAppName);
- }
-
- @Override
- public CallIdentification[] newArray(int size) {
- return new CallIdentification[size];
- }
- };
-
- /**
- * The name associated with the number.
- * <p>
- * The name of the call as identified by a {@link CallScreeningService}. Could be a business
- * name, for example.
- *
- * @return The name associated with the number, or {@code null} if none was provided.
- */
- public final @Nullable CharSequence getName() {
- return mName;
- }
-
- /**
- * Description of the call.
- * <p>
- * A description of the call as identified by a {@link CallScreeningService}. The description
- * is typically presented by Dialer apps after the {@link #getName() name} to provide a short
- * piece of relevant information about the call. This could include a location, address, or a
- * message regarding the potential nature of the call (e.g. potential telemarketer).
- *
- * @return The call description, or {@code null} if none was provided.
- */
- public final @Nullable CharSequence getDescription() {
- return mDescription;
- }
-
- /**
- * Details of the call.
- * <p>
- * Details of the call as identified by a {@link CallScreeningService}. The details
- * are typically presented by Dialer apps after the {@link #getName() name} and
- * {@link #getDescription() description} to provide further clarifying information about the
- * call. This could include, for example, the opening hours of a business, or stats about
- * the number of times a call has been reported as spam.
- *
- * @return The call details, or {@code null} if none was provided.
- */
- public final @Nullable CharSequence getDetails() {
- return mDetails;
- }
-
- /**
- * Photo associated with the call.
- * <p>
- * A photo associated with the call as identified by a {@link CallScreeningService}. This
- * could be, for example, a business logo, or a photo of the caller.
- *
- * @return The photo associated with the call, or {@code null} if none was provided.
- */
- public final @Nullable Icon getPhoto() {
- return mPhoto;
- }
-
- /**
- * Indicates the likelihood that this call is a nuisance call.
- * <p>
- * How likely the call is a nuisance call, as identified by a {@link CallScreeningService}.
- *
- * @return The nuisance confidence.
- */
- public final @NuisanceConfidence int getNuisanceConfidence() {
- return mNuisanceConfidence;
- }
-
- /**
- * The package name of the {@link CallScreeningService} which provided the
- * {@link CallIdentification}.
- * <p>
- * A {@link CallScreeningService} may not set this property; it is set by the system.
- * @return the package name
- */
- public final @NonNull String getCallScreeningPackageName() {
- return mCallScreeningPackageName;
- }
-
- /**
- * The {@link android.content.pm.PackageManager#getApplicationLabel(ApplicationInfo) name} of
- * the {@link CallScreeningService} which provided the {@link CallIdentification}.
- * <p>
- * A {@link CallScreeningService} may not set this property; it is set by the system.
- *
- * @return The name of the app.
- */
- public final @NonNull CharSequence getCallScreeningAppName() {
- return mCallScreeningAppName;
- }
-
- /**
- * Set the package name of the {@link CallScreeningService} which provided this information.
- *
- * @param callScreeningPackageName The package name.
- * @hide
- */
- public void setCallScreeningPackageName(@NonNull String callScreeningPackageName) {
- mCallScreeningPackageName = callScreeningPackageName;
- }
-
- /**
- * Set the app name of the {@link CallScreeningService} which provided this information.
- *
- * @param callScreeningAppName The app name.
- * @hide
- */
- public void setCallScreeningAppName(@NonNull CharSequence callScreeningAppName) {
- mCallScreeningAppName = callScreeningAppName;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- CallIdentification that = (CallIdentification) o;
- // Note: mPhoto purposely omit as no good comparison exists.
- return mNuisanceConfidence == that.mNuisanceConfidence
- && Objects.equals(mName, that.mName)
- && Objects.equals(mDescription, that.mDescription)
- && Objects.equals(mDetails, that.mDetails)
- && Objects.equals(mCallScreeningAppName, that.mCallScreeningAppName)
- && Objects.equals(mCallScreeningPackageName, that.mCallScreeningPackageName);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(mName, mDescription, mDetails, mPhoto, mNuisanceConfidence,
- mCallScreeningAppName, mCallScreeningPackageName);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("[CallId mName=");
- sb.append(Log.pii(mName));
- sb.append(", mDesc=");
- sb.append(mDescription);
- sb.append(", mDet=");
- sb.append(mDetails);
- sb.append(", conf=");
- sb.append(mNuisanceConfidence);
- sb.append(", appName=");
- sb.append(mCallScreeningAppName);
- sb.append(", pkgName=");
- sb.append(mCallScreeningPackageName);
- return sb.toString();
- }
-}
diff --git a/telecomm/java/android/telecom/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java
index 818ebd9..27a8638 100644
--- a/telecomm/java/android/telecom/CallScreeningService.java
+++ b/telecomm/java/android/telecom/CallScreeningService.java
@@ -39,8 +39,8 @@
/**
* This service can be implemented by the default dialer (see
* {@link TelecomManager#getDefaultDialerPackage()}) or a third party app to allow or disallow
- * incoming calls before they are shown to a user. This service can also provide
- * {@link CallIdentification} information for calls.
+ * incoming calls before they are shown to a user. A {@link CallScreeningService} can also see
+ * outgoing calls for the purpose of providing caller ID services for those calls.
* <p>
* Below is an example manifest registration for a {@code CallScreeningService}.
* <pre>
@@ -58,9 +58,9 @@
* <ol>
* <li>Call blocking/screening - the service can choose which calls will ring on the user's
* device, and which will be silently sent to voicemail.</li>
- * <li>Call identification - the service can optionally provide {@link CallIdentification}
- * information about a {@link Call.Details call} which will be shown to the user in the
- * Dialer app.</li>
+ * <li>Call identification - services which provide call identification functionality can
+ * display a user-interface of their choosing which contains identifying information for a call.
+ * </li>
* </ol>
* <p>
* <h2>Becoming the {@link CallScreeningService}</h2>
@@ -92,128 +92,6 @@
* </pre>
*/
public abstract class CallScreeningService extends Service {
-
- /** @hide */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef(
- prefix = { "CALL_DURATION_" },
- value = {CALL_DURATION_VERY_SHORT, CALL_DURATION_SHORT, CALL_DURATION_MEDIUM,
- CALL_DURATION_LONG})
- public @interface CallDuration {}
-
- /**
- * Call duration reported with {@link #EXTRA_CALL_DURATION} to indicate to the
- * {@link CallScreeningService} the duration of a call for which the user reported the nuisance
- * status (see {@link TelecomManager#reportNuisanceCallStatus(Uri, boolean)}). The
- * {@link CallScreeningService} can use this as a signal for training nuisance detection
- * algorithms. The call duration is reported in coarse grained buckets to minimize exposure of
- * identifying call log information to the {@link CallScreeningService}.
- * <p>
- * Indicates the call was < 3 seconds in duration.
- */
- public static final int CALL_DURATION_VERY_SHORT = 1;
-
- /**
- * Call duration reported with {@link #EXTRA_CALL_DURATION} to indicate to the
- * {@link CallScreeningService} the duration of a call for which the user reported the nuisance
- * status (see {@link TelecomManager#reportNuisanceCallStatus(Uri, boolean)}). The
- * {@link CallScreeningService} can use this as a signal for training nuisance detection
- * algorithms. The call duration is reported in coarse grained buckets to minimize exposure of
- * identifying call log information to the {@link CallScreeningService}.
- * <p>
- * Indicates the call was greater than 3 seconds, but less than 60 seconds in duration.
- */
- public static final int CALL_DURATION_SHORT = 2;
-
- /**
- * Call duration reported with {@link #EXTRA_CALL_DURATION} to indicate to the
- * {@link CallScreeningService} the duration of a call for which the user reported the nuisance
- * status (see {@link TelecomManager#reportNuisanceCallStatus(Uri, boolean)}). The
- * {@link CallScreeningService} can use this as a signal for training nuisance detection
- * algorithms. The call duration is reported in coarse grained buckets to minimize exposure of
- * identifying call log information to the {@link CallScreeningService}.
- * <p>
- * Indicates the call was greater than 60 seconds, but less than 120 seconds in duration.
- */
- public static final int CALL_DURATION_MEDIUM = 3;
-
- /**
- * Call duration reported with {@link #EXTRA_CALL_DURATION} to indicate to the
- * {@link CallScreeningService} the duration of a call for which the user reported the nuisance
- * status (see {@link TelecomManager#reportNuisanceCallStatus(Uri, boolean)}). The
- * {@link CallScreeningService} can use this as a signal for training nuisance detection
- * algorithms. The call duration is reported in coarse grained buckets to minimize exposure of
- * identifying call log information to the {@link CallScreeningService}.
- * <p>
- * Indicates the call was greater than 120 seconds.
- */
- public static final int CALL_DURATION_LONG = 4;
-
- /**
- * Telecom sends this intent to the {@link CallScreeningService} which the user has chosen to
- * fill the call screening role when the user indicates through the default dialer whether a
- * call is a nuisance call or not (see
- * {@link TelecomManager#reportNuisanceCallStatus(Uri, boolean)}).
- * <p>
- * The following extra values are provided for the call:
- * <ol>
- * <li>{@link #EXTRA_CALL_HANDLE} - the handle of the call.</li>
- * <li>{@link #EXTRA_IS_NUISANCE} - {@code true} if the user reported the call as a nuisance
- * call, {@code false} otherwise.</li>
- * <li>{@link #EXTRA_CALL_TYPE} - reports the type of call (incoming, rejected, missed,
- * blocked).</li>
- * <li>{@link #EXTRA_CALL_DURATION} - the duration of the call (see
- * {@link #EXTRA_CALL_DURATION} for valid values).</li>
- * </ol>
- * <p>
- * {@link CallScreeningService} implementations which want to track whether the user reports
- * calls are nuisance calls should use declare a broadcast receiver in their manifest for this
- * intent.
- * <p>
- * Note: Only {@link CallScreeningService} implementations which have provided
- * {@link CallIdentification} information for calls at some point will receive this intent.
- */
- public static final String ACTION_NUISANCE_CALL_STATUS_CHANGED =
- "android.telecom.action.NUISANCE_CALL_STATUS_CHANGED";
-
- /**
- * Extra used to provide the handle of the call for
- * {@link #ACTION_NUISANCE_CALL_STATUS_CHANGED}. The call handle is reported as a
- * {@link Uri}.
- */
- public static final String EXTRA_CALL_HANDLE = "android.telecom.extra.CALL_HANDLE";
-
- /**
- * Boolean extra used to indicate whether the user reported a call as a nuisance call.
- * When {@code true}, the user reported that a call was a nuisance call, {@code false}
- * otherwise. Sent with {@link #ACTION_NUISANCE_CALL_STATUS_CHANGED}.
- */
- public static final String EXTRA_IS_NUISANCE = "android.telecom.extra.IS_NUISANCE";
-
- /**
- * Integer extra used with {@link #ACTION_NUISANCE_CALL_STATUS_CHANGED} to report the type of
- * call. Valid values are:
- * <UL>
- * <li>{@link android.provider.CallLog.Calls#MISSED_TYPE}</li>
- * <li>{@link android.provider.CallLog.Calls#INCOMING_TYPE}</li>
- * <li>{@link android.provider.CallLog.Calls#BLOCKED_TYPE}</li>
- * <li>{@link android.provider.CallLog.Calls#REJECTED_TYPE}</li>
- * </UL>
- */
- public static final String EXTRA_CALL_TYPE = "android.telecom.extra.CALL_TYPE";
-
- /**
- * Integer extra used to with {@link #ACTION_NUISANCE_CALL_STATUS_CHANGED} to report how long
- * the call lasted. Valid values are:
- * <UL>
- * <LI>{@link #CALL_DURATION_VERY_SHORT}</LI>
- * <LI>{@link #CALL_DURATION_SHORT}</LI>
- * <LI>{@link #CALL_DURATION_MEDIUM}</LI>
- * <LI>{@link #CALL_DURATION_LONG}</LI>
- * </UL>
- */
- public static final String EXTRA_CALL_DURATION = "android.telecom.extra.CALL_DURATION";
-
/**
* The {@link Intent} that must be declared as handled by the service.
*/
@@ -386,10 +264,6 @@
* Your app can tell if a call is an incoming call by checking to see if
* {@link Call.Details#getCallDirection()} is {@link Call.Details#DIRECTION_INCOMING}.
* <p>
- * For incoming or outgoing calls, the {@link CallScreeningService} can call
- * {@link #provideCallIdentification(Call.Details, CallIdentification)} in order to provide
- * {@link CallIdentification} for the call.
- * <p>
* Note: The {@link Call.Details} instance provided to a call screening service will only have
* the following properties set. The rest of the {@link Call.Details} properties will be set to
* their default value or {@code null}.
@@ -442,32 +316,4 @@
} catch (RemoteException e) {
}
}
-
- /**
- * Provide {@link CallIdentification} information about a {@link Call.Details call}.
- * <p>
- * The {@link CallScreeningService} calls this method to provide information it has identified
- * about a {@link Call.Details call}. This information will potentially be shown to the user
- * in the {@link InCallService dialer} app. It will be logged to the
- * {@link android.provider.CallLog}.
- * <p>
- * A {@link CallScreeningService} should only call this method for calls for which it is able to
- * provide some {@link CallIdentification} for. {@link CallIdentification} instances with no
- * fields set will be ignored by the system.
- *
- * @param callDetails The call to provide information for.
- * <p>
- * Must be the same {@link Call.Details call} which was provided to the
- * {@link CallScreeningService} via {@link #onScreenCall(Call.Details)}.
- * @param identification An instance of {@link CallIdentification} with information about the
- * {@link Call.Details call}.
- */
- public final void provideCallIdentification(@NonNull Call.Details callDetails,
- @NonNull CallIdentification identification) {
- try {
- mCallScreeningAdapter.provideCallIdentification(callDetails.getTelecomCallId(),
- identification);
- } catch (RemoteException e) {
- }
- }
}
diff --git a/telecomm/java/android/telecom/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java
index f7dec83..22348ac 100644
--- a/telecomm/java/android/telecom/ParcelableCall.java
+++ b/telecomm/java/android/telecom/ParcelableCall.java
@@ -64,7 +64,6 @@
private final Bundle mIntentExtras;
private final Bundle mExtras;
private final long mCreationTimeMillis;
- private final CallIdentification mCallIdentification;
private final int mCallDirection;
public ParcelableCall(
@@ -94,7 +93,6 @@
Bundle intentExtras,
Bundle extras,
long creationTimeMillis,
- CallIdentification callIdentification,
int callDirection) {
mId = id;
mState = state;
@@ -122,7 +120,6 @@
mIntentExtras = intentExtras;
mExtras = extras;
mCreationTimeMillis = creationTimeMillis;
- mCallIdentification = callIdentification;
mCallDirection = callDirection;
}
@@ -314,15 +311,6 @@
}
/**
- * Contains call identification information returned by a {@link CallScreeningService}.
- * @return The {@link CallIdentification} for this call, or {@code null} if a
- * {@link CallScreeningService} did not provide information.
- */
- public @Nullable CallIdentification getCallIdentification() {
- return mCallIdentification;
- }
-
- /**
* Indicates whether the call is an incoming or outgoing call.
*/
public @CallDirection int getCallDirection() {
@@ -366,7 +354,6 @@
boolean isRttCallChanged = source.readByte() == 1;
ParcelableRttCall rttCall = source.readParcelable(classLoader);
long creationTimeMillis = source.readLong();
- CallIdentification callIdentification = source.readParcelable(classLoader);
int callDirection = source.readInt();
return new ParcelableCall(
id,
@@ -395,7 +382,6 @@
intentExtras,
extras,
creationTimeMillis,
- callIdentification,
callDirection);
}
@@ -441,7 +427,6 @@
destination.writeByte((byte) (mIsRttCallChanged ? 1 : 0));
destination.writeParcelable(mRttCall, 0);
destination.writeLong(mCreationTimeMillis);
- destination.writeParcelable(mCallIdentification, 0);
destination.writeInt(mCallDirection);
}
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 06c85d2..6a2037f 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -2004,33 +2004,6 @@
}
/**
- * Called by the default dialer to report to Telecom when the user has marked a previous
- * incoming call as a nuisance call or not.
- * <p>
- * Where the user has chosen a {@link CallScreeningService} to fill the call screening role,
- * Telecom will notify that {@link CallScreeningService} of the user's report.
- * <p>
- * Requires that the caller is the default dialer app.
- *
- * @param handle The phone number of an incoming call which the user is reporting as either a
- * nuisance of non-nuisance call.
- * @param isNuisanceCall {@code true} if the user is reporting the call as a nuisance call,
- * {@code false} if the user is reporting the call as a non-nuisance call.
- */
- @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
- public void reportNuisanceCallStatus(@NonNull Uri handle, boolean isNuisanceCall) {
- ITelecomService service = getTelecomService();
- if (service != null) {
- try {
- service.reportNuisanceCallStatus(handle, isNuisanceCall,
- mContext.getOpPackageName());
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelecomService#showCallScreen", e);
- }
- }
- }
-
- /**
* Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
* @param intent The {@link Intent#ACTION_CALL} intent to handle.
* @hide
diff --git a/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl b/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl
index a86c830..d255ed1 100644
--- a/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl
@@ -17,7 +17,6 @@
package com.android.internal.telecom;
import android.content.ComponentName;
-import android.telecom.CallIdentification;
/**
* Internal remote callback interface for call screening services.
@@ -35,8 +34,4 @@
boolean shouldAddToCallLog,
boolean shouldShowNotification,
in ComponentName componentName);
-
- void provideCallIdentification(
- String callId,
- in CallIdentification callIdentification);
}
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 93eea56..a814c03 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -286,8 +286,6 @@
*/
boolean isInEmergencyCall();
- oneway void reportNuisanceCallStatus(in Uri address, boolean isNuisance, String callingPackage);
-
/**
* @see TelecomServiceImpl#handleCallIntent
*/
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 1bb1bc4..0dd6614 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -2557,6 +2557,48 @@
public static final String KEY_5G_ICON_CONFIGURATION_STRING =
"5g_icon_configuration_string";
+ /**
+ * Passing this value as {@link KEY_SUBSCRIPTION_GROUP_UUID_STRING} will remove the
+ * subscription from a group instead of adding it to a group.
+ *
+ * TODO: Expose in a future release.
+ *
+ * @hide
+ */
+ public static final String REMOVE_GROUP_UUID_STRING = "00000000-0000-0000-0000-000000000000";
+
+ /**
+ * The UUID of a Group of related subscriptions in which to place the current subscription.
+ *
+ * A grouped subscription will behave for billing purposes and other UI purposes as though it
+ * is a transparent extension of other subscriptions in the group.
+ *
+ * <p>If set to {@link #REMOVE_GROUP_UUID_STRING}, then the subscription will be removed from
+ * its current group.
+ *
+ * TODO: unhide this key.
+ *
+ * @hide
+ */
+ public static final String KEY_SUBSCRIPTION_GROUP_UUID_STRING =
+ "key_subscription_group_uuid_string";
+
+ /**
+ * A boolean property indicating whether this subscription should be managed as an opportunistic
+ * subscription.
+ *
+ * If true, then this subscription will be selected based on available coverage and will not be
+ * available for a user in settings menus for selecting macro network providers. If unset,
+ * defaults to “false”.
+ *
+ * TODO: unhide this key.
+ *
+ * @hide
+ */
+ public static final String KEY_IS_OPPORTUNISTIC_SUBSCRIPTION_BOOL =
+ "key_is_opportunistic_subscription_bool";
+
+
/** The default value for every variable. */
private final static PersistableBundle sDefaults;
@@ -2948,6 +2990,8 @@
sDefaults.putBoolean(KEY_AUTO_CANCEL_CS_REJECT_NOTIFICATION, false);
sDefaults.putBoolean(KEY_ALWAYS_SHOW_PRIMARY_SIGNAL_BAR_IN_OPPORTUNISTIC_NETWORK_BOOLEAN,
false);
+ sDefaults.putString(KEY_SUBSCRIPTION_GROUP_UUID_STRING, "");
+ sDefaults.putBoolean(KEY_IS_OPPORTUNISTIC_SUBSCRIPTION_BOOL, false);
}
/**
diff --git a/telephony/java/android/telephony/DataSpecificRegistrationInfo.java b/telephony/java/android/telephony/DataSpecificRegistrationInfo.java
index 465c2b1..2cb369d 100644
--- a/telephony/java/android/telephony/DataSpecificRegistrationInfo.java
+++ b/telephony/java/android/telephony/DataSpecificRegistrationInfo.java
@@ -78,7 +78,7 @@
*
* @hide
*/
- public final boolean isUsingCarrierAggregation;
+ public boolean mIsUsingCarrierAggregation;
/**
* @hide
@@ -92,7 +92,7 @@
this.isNrAvailable = isNrAvailable;
this.isEnDcAvailable = isEnDcAvailable;
this.mLteVopsSupportInfo = lteVops;
- this.isUsingCarrierAggregation = isUsingCarrierAggregation;
+ this.mIsUsingCarrierAggregation = isUsingCarrierAggregation;
}
private DataSpecificRegistrationInfo(Parcel source) {
@@ -101,7 +101,7 @@
isNrAvailable = source.readBoolean();
isEnDcAvailable = source.readBoolean();
mLteVopsSupportInfo = LteVopsSupportInfo.CREATOR.createFromParcel(source);
- isUsingCarrierAggregation = source.readBoolean();
+ mIsUsingCarrierAggregation = source.readBoolean();
}
@Override
@@ -111,7 +111,7 @@
dest.writeBoolean(isNrAvailable);
dest.writeBoolean(isEnDcAvailable);
mLteVopsSupportInfo.writeToParcel(dest, flags);
- dest.writeBoolean(isUsingCarrierAggregation);
+ dest.writeBoolean(mIsUsingCarrierAggregation);
}
@Override
@@ -128,7 +128,7 @@
.append(" isNrAvailable = " + isNrAvailable)
.append(" isEnDcAvailable = " + isEnDcAvailable)
.append(" " + mLteVopsSupportInfo.toString())
- .append(" isUsingCarrierAggregation = " + isUsingCarrierAggregation)
+ .append(" mIsUsingCarrierAggregation = " + mIsUsingCarrierAggregation)
.append(" }")
.toString();
}
@@ -136,7 +136,7 @@
@Override
public int hashCode() {
return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable, isEnDcAvailable,
- mLteVopsSupportInfo, isUsingCarrierAggregation);
+ mLteVopsSupportInfo, mIsUsingCarrierAggregation);
}
@Override
@@ -151,7 +151,7 @@
&& this.isNrAvailable == other.isNrAvailable
&& this.isEnDcAvailable == other.isEnDcAvailable
&& this.mLteVopsSupportInfo.equals(other.mLteVopsSupportInfo)
- && this.isUsingCarrierAggregation == other.isUsingCarrierAggregation;
+ && this.mIsUsingCarrierAggregation == other.mIsUsingCarrierAggregation;
}
public static final @NonNull Parcelable.Creator<DataSpecificRegistrationInfo> CREATOR =
@@ -174,4 +174,22 @@
public LteVopsSupportInfo getLteVopsSupportInfo() {
return mLteVopsSupportInfo;
}
+
+ /**
+ * Set the flag indicating if using carrier aggregation.
+ *
+ * @param isUsingCarrierAggregation {@code true} if using carrier aggregation.
+ * @hide
+ */
+ public void setIsUsingCarrierAggregation(boolean isUsingCarrierAggregation) {
+ mIsUsingCarrierAggregation = isUsingCarrierAggregation;
+ }
+
+ /**
+ * @return {@code true} if using carrier aggregation.
+ * @hide
+ */
+ public boolean isUsingCarrierAggregation() {
+ return mIsUsingCarrierAggregation;
+ }
}
diff --git a/telephony/java/android/telephony/NetworkRegistrationInfo.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java
index 2bb02e7..7b9f6d5 100644
--- a/telephony/java/android/telephony/NetworkRegistrationInfo.java
+++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java
@@ -368,6 +368,13 @@
* @hide
*/
public void setAccessNetworkTechnology(@NetworkType int tech) {
+ if (tech == TelephonyManager.NETWORK_TYPE_LTE_CA) {
+ // For old device backward compatibility support
+ tech = TelephonyManager.NETWORK_TYPE_LTE;
+ if (mDataSpecificInfo != null) {
+ mDataSpecificInfo.setIsUsingCarrierAggregation(true);
+ }
+ }
mAccessNetworkTechnology = tech;
}
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 549c044..b75e515 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -2016,7 +2016,16 @@
private static boolean isEmergencyNumberInternal(int subId, String number,
String defaultCountryIso,
boolean useExactMatch) {
- return TelephonyManager.getDefault().isEmergencyNumber(number);
+ try {
+ if (useExactMatch) {
+ return TelephonyManager.getDefault().isEmergencyNumber(number);
+ } else {
+ return TelephonyManager.getDefault().isPotentialEmergencyNumber(number);
+ }
+ } catch (RuntimeException ex) {
+ Rlog.e(LOG_TAG, "isEmergencyNumberInternal: RuntimeException: " + ex);
+ }
+ return false;
}
/**
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index caf27b7..f928ba0 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -312,18 +312,6 @@
private boolean mIsManualNetworkSelection;
private boolean mIsEmergencyOnly;
- /**
- * TODO: remove mRilVoiceRadioTechnology after completely migrate to
- * {@link TelephonyManager.NetworkType}
- */
- @RilRadioTechnology
- private int mRilVoiceRadioTechnology;
- /**
- * TODO: remove mRilDataRadioTechnology after completely migrate to
- * {@link TelephonyManager.NetworkType}
- */
- @RilRadioTechnology
- private int mRilDataRadioTechnology;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
private boolean mCssIndicator;
@@ -340,9 +328,6 @@
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
private int mCdmaEriIconMode;
- @UnsupportedAppUsage
- private boolean mIsUsingCarrierAggregation;
-
@FrequencyRange
private int mNrFrequencyRange;
private int mChannelNumber;
@@ -420,8 +405,6 @@
mDataOperatorAlphaShort = s.mDataOperatorAlphaShort;
mDataOperatorNumeric = s.mDataOperatorNumeric;
mIsManualNetworkSelection = s.mIsManualNetworkSelection;
- mRilVoiceRadioTechnology = s.mRilVoiceRadioTechnology;
- mRilDataRadioTechnology = s.mRilDataRadioTechnology;
mCssIndicator = s.mCssIndicator;
mNetworkId = s.mNetworkId;
mSystemId = s.mSystemId;
@@ -430,7 +413,6 @@
mCdmaEriIconIndex = s.mCdmaEriIconIndex;
mCdmaEriIconMode = s.mCdmaEriIconMode;
mIsEmergencyOnly = s.mIsEmergencyOnly;
- mIsUsingCarrierAggregation = s.mIsUsingCarrierAggregation;
mChannelNumber = s.mChannelNumber;
mCellBandwidths = s.mCellBandwidths == null ? null :
Arrays.copyOf(s.mCellBandwidths, s.mCellBandwidths.length);
@@ -457,8 +439,6 @@
mDataOperatorAlphaShort = in.readString();
mDataOperatorNumeric = in.readString();
mIsManualNetworkSelection = in.readInt() != 0;
- mRilVoiceRadioTechnology = in.readInt();
- mRilDataRadioTechnology = in.readInt();
mCssIndicator = (in.readInt() != 0);
mNetworkId = in.readInt();
mSystemId = in.readInt();
@@ -467,7 +447,6 @@
mCdmaEriIconIndex = in.readInt();
mCdmaEriIconMode = in.readInt();
mIsEmergencyOnly = in.readInt() != 0;
- mIsUsingCarrierAggregation = in.readInt() != 0;
mLteEarfcnRsrpBoost = in.readInt();
mNetworkRegistrationInfos = new ArrayList<>();
in.readList(mNetworkRegistrationInfos, NetworkRegistrationInfo.class.getClassLoader());
@@ -486,8 +465,6 @@
out.writeString(mDataOperatorAlphaShort);
out.writeString(mDataOperatorNumeric);
out.writeInt(mIsManualNetworkSelection ? 1 : 0);
- out.writeInt(mRilVoiceRadioTechnology);
- out.writeInt(mRilDataRadioTechnology);
out.writeInt(mCssIndicator ? 1 : 0);
out.writeInt(mNetworkId);
out.writeInt(mSystemId);
@@ -496,7 +473,6 @@
out.writeInt(mCdmaEriIconIndex);
out.writeInt(mCdmaEriIconMode);
out.writeInt(mIsEmergencyOnly ? 1 : 0);
- out.writeInt(mIsUsingCarrierAggregation ? 1 : 0);
out.writeInt(mLteEarfcnRsrpBoost);
out.writeList(mNetworkRegistrationInfos);
out.writeInt(mChannelNumber);
@@ -568,7 +544,7 @@
@DuplexMode
public int getDuplexMode() {
// only support LTE duplex mode
- if (!isLte(mRilDataRadioTechnology)) {
+ if (!isLte(getRilDataRadioTechnology())) {
return DUPLEX_MODE_UNKNOWN;
}
@@ -850,8 +826,6 @@
mDataOperatorAlphaShort,
mDataOperatorNumeric,
mIsManualNetworkSelection,
- mRilVoiceRadioTechnology,
- mRilDataRadioTechnology,
mCssIndicator,
mNetworkId,
mSystemId,
@@ -860,7 +834,6 @@
mCdmaEriIconIndex,
mCdmaEriIconMode,
mIsEmergencyOnly,
- mIsUsingCarrierAggregation,
mLteEarfcnRsrpBoost,
mNetworkRegistrationInfos,
mNrFrequencyRange);
@@ -871,7 +844,7 @@
if (!(o instanceof ServiceState)) return false;
ServiceState s = (ServiceState) o;
- return (mVoiceRegState == s.mVoiceRegState
+ return mVoiceRegState == s.mVoiceRegState
&& mDataRegState == s.mDataRegState
&& mIsManualNetworkSelection == s.mIsManualNetworkSelection
&& mChannelNumber == s.mChannelNumber
@@ -882,8 +855,6 @@
&& equalsHandlesNulls(mDataOperatorAlphaLong, s.mDataOperatorAlphaLong)
&& equalsHandlesNulls(mDataOperatorAlphaShort, s.mDataOperatorAlphaShort)
&& equalsHandlesNulls(mDataOperatorNumeric, s.mDataOperatorNumeric)
- && equalsHandlesNulls(mRilVoiceRadioTechnology, s.mRilVoiceRadioTechnology)
- && equalsHandlesNulls(mRilDataRadioTechnology, s.mRilDataRadioTechnology)
&& equalsHandlesNulls(mCssIndicator, s.mCssIndicator)
&& equalsHandlesNulls(mNetworkId, s.mNetworkId)
&& equalsHandlesNulls(mSystemId, s.mSystemId)
@@ -891,7 +862,6 @@
&& equalsHandlesNulls(mCdmaDefaultRoamingIndicator,
s.mCdmaDefaultRoamingIndicator)
&& mIsEmergencyOnly == s.mIsEmergencyOnly
- && mIsUsingCarrierAggregation == s.mIsUsingCarrierAggregation)
&& (mNetworkRegistrationInfos == null
? s.mNetworkRegistrationInfos == null : s.mNetworkRegistrationInfos != null
&& mNetworkRegistrationInfos.containsAll(s.mNetworkRegistrationInfos))
@@ -1035,27 +1005,27 @@
.append(", mDataOperatorAlphaShort=").append(mDataOperatorAlphaShort)
.append(", isManualNetworkSelection=").append(mIsManualNetworkSelection)
.append(mIsManualNetworkSelection ? "(manual)" : "(automatic)")
- .append(", mRilVoiceRadioTechnology=").append(mRilVoiceRadioTechnology)
- .append("(" + rilRadioTechnologyToString(mRilVoiceRadioTechnology) + ")")
- .append(", mRilDataRadioTechnology=").append(mRilDataRadioTechnology)
- .append("(" + rilRadioTechnologyToString(mRilDataRadioTechnology) + ")")
+ .append(", getRilVoiceRadioTechnology=").append(getRilVoiceRadioTechnology())
+ .append("(" + rilRadioTechnologyToString(getRilVoiceRadioTechnology()) + ")")
+ .append(", getRilDataRadioTechnology=").append(getRilDataRadioTechnology())
+ .append("(" + rilRadioTechnologyToString(getRilDataRadioTechnology()) + ")")
.append(", mCssIndicator=").append(mCssIndicator ? "supported" : "unsupported")
.append(", mNetworkId=").append(mNetworkId)
.append(", mSystemId=").append(mSystemId)
.append(", mCdmaRoamingIndicator=").append(mCdmaRoamingIndicator)
.append(", mCdmaDefaultRoamingIndicator=").append(mCdmaDefaultRoamingIndicator)
.append(", mIsEmergencyOnly=").append(mIsEmergencyOnly)
- .append(", mIsUsingCarrierAggregation=").append(mIsUsingCarrierAggregation)
+ .append(", isUsingCarrierAggregation=").append(isUsingCarrierAggregation())
.append(", mLteEarfcnRsrpBoost=").append(mLteEarfcnRsrpBoost)
.append(", mNetworkRegistrationInfos=").append(mNetworkRegistrationInfos)
.append(", mNrFrequencyRange=").append(mNrFrequencyRange)
.append("}").toString();
}
- private void setNullState(int state) {
- if (DBG) Rlog.d(LOG_TAG, "[ServiceState] setNullState=" + state);
- mVoiceRegState = state;
- mDataRegState = state;
+ private void init() {
+ if (DBG) Rlog.d(LOG_TAG, "init");
+ mVoiceRegState = STATE_OUT_OF_SERVICE;
+ mDataRegState = STATE_OUT_OF_SERVICE;
mChannelNumber = -1;
mCellBandwidths = new int[0];
mVoiceOperatorAlphaLong = null;
@@ -1065,8 +1035,6 @@
mDataOperatorAlphaShort = null;
mDataOperatorNumeric = null;
mIsManualNetworkSelection = false;
- mRilVoiceRadioTechnology = 0;
- mRilDataRadioTechnology = 0;
mCssIndicator = false;
mNetworkId = -1;
mSystemId = -1;
@@ -1075,18 +1043,28 @@
mCdmaEriIconIndex = -1;
mCdmaEriIconMode = -1;
mIsEmergencyOnly = false;
- mIsUsingCarrierAggregation = false;
mLteEarfcnRsrpBoost = 0;
- mNetworkRegistrationInfos = new ArrayList<>();
mNrFrequencyRange = FREQUENCY_RANGE_UNKNOWN;
+ addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
+ .setDomain(NetworkRegistrationInfo.DOMAIN_CS)
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
+ .build());
+ addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
+ .build());
}
public void setStateOutOfService() {
- setNullState(STATE_OUT_OF_SERVICE);
+ init();
}
public void setStateOff() {
- setNullState(STATE_POWER_OFF);
+ init();
+ mVoiceRegState = STATE_POWER_OFF;
+ mDataRegState = STATE_POWER_OFF;
}
public void setState(int state) {
@@ -1304,8 +1282,8 @@
m.putString("data-operator-alpha-short", mDataOperatorAlphaShort);
m.putString("data-operator-numeric", mDataOperatorNumeric);
m.putBoolean("manual", mIsManualNetworkSelection);
- m.putInt("radioTechnology", mRilVoiceRadioTechnology);
- m.putInt("dataRadioTechnology", mRilDataRadioTechnology);
+ m.putInt("radioTechnology", getRilVoiceRadioTechnology());
+ m.putInt("dataRadioTechnology", getRadioTechnology());
m.putBoolean("cssIndicator", mCssIndicator);
m.putInt("networkId", mNetworkId);
m.putInt("systemId", mSystemId);
@@ -1313,7 +1291,7 @@
m.putInt("cdmaDefaultRoamingIndicator", mCdmaDefaultRoamingIndicator);
m.putBoolean("emergencyOnly", mIsEmergencyOnly);
m.putBoolean("isDataRoamingFromRegistration", getDataRoamingFromRegistration());
- m.putBoolean("isUsingCarrierAggregation", mIsUsingCarrierAggregation);
+ m.putBoolean("isUsingCarrierAggregation", isUsingCarrierAggregation());
m.putInt("LteEarfcnRsrpBoost", mLteEarfcnRsrpBoost);
m.putInt("ChannelNumber", mChannelNumber);
m.putIntArray("CellBandwidths", mCellBandwidths);
@@ -1323,13 +1301,9 @@
/** @hide */
@TestApi
public void setRilVoiceRadioTechnology(@RilRadioTechnology int rt) {
- if (rt == RIL_RADIO_TECHNOLOGY_LTE_CA) {
- rt = RIL_RADIO_TECHNOLOGY_LTE;
- }
-
- this.mRilVoiceRadioTechnology = rt;
-
- // sync to network registration state
+ Rlog.e(LOG_TAG, "ServiceState.setRilVoiceRadioTechnology() called. It's encouraged to "
+ + "use addNetworkRegistrationInfo() instead *******");
+ // Sync to network registration state
NetworkRegistrationInfo regState = getNetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
if (regState == null) {
@@ -1339,24 +1313,18 @@
.build();
addNetworkRegistrationInfo(regState);
}
- regState.setAccessNetworkTechnology(
- rilRadioTechnologyToNetworkType(mRilVoiceRadioTechnology));
+ regState.setAccessNetworkTechnology(rilRadioTechnologyToNetworkType(rt));
}
+
/** @hide */
@TestApi
public void setRilDataRadioTechnology(@RilRadioTechnology int rt) {
- if (rt == RIL_RADIO_TECHNOLOGY_LTE_CA) {
- rt = RIL_RADIO_TECHNOLOGY_LTE;
- this.mIsUsingCarrierAggregation = true;
- } else {
- this.mIsUsingCarrierAggregation = false;
- }
- this.mRilDataRadioTechnology = rt;
- if (VDBG) Rlog.d(LOG_TAG, "[ServiceState] setRilDataRadioTechnology=" +
- mRilDataRadioTechnology);
-
- // sync to network registration state
+ Rlog.e(LOG_TAG, "ServiceState.setRilDataRadioTechnology() called. It's encouraged to "
+ + "use addNetworkRegistrationInfo() instead *******");
+ // Sync to network registration state. Always write down the WWAN transport. For AP-assisted
+ // mode device, use addNetworkRegistrationInfo() to set the correct transport if RAT
+ // is IWLAN.
NetworkRegistrationInfo regState = getNetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
@@ -1367,18 +1335,32 @@
.build();
addNetworkRegistrationInfo(regState);
}
- regState.setAccessNetworkTechnology(
- rilRadioTechnologyToNetworkType(mRilDataRadioTechnology));
+ regState.setAccessNetworkTechnology(rilRadioTechnologyToNetworkType(rt));
}
/** @hide */
public boolean isUsingCarrierAggregation() {
- return mIsUsingCarrierAggregation;
+ NetworkRegistrationInfo nri = getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ if (nri != null) {
+ DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
+ if (dsri != null) {
+ return dsri.isUsingCarrierAggregation();
+ }
+ }
+ return false;
}
/** @hide */
public void setIsUsingCarrierAggregation(boolean ca) {
- mIsUsingCarrierAggregation = ca;
+ NetworkRegistrationInfo nri = getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ if (nri != null) {
+ DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
+ if (dsri != null) {
+ dsri.setIsUsingCarrierAggregation(ca);
+ }
+ }
}
/**
@@ -1435,12 +1417,29 @@
/** @hide */
@UnsupportedAppUsage
public int getRilVoiceRadioTechnology() {
- return this.mRilVoiceRadioTechnology;
+ NetworkRegistrationInfo wwanRegInfo = getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ if (wwanRegInfo != null) {
+ return networkTypeToRilRadioTechnology(wwanRegInfo.getAccessNetworkTechnology());
+ }
+ return RIL_RADIO_TECHNOLOGY_UNKNOWN;
}
/** @hide */
@UnsupportedAppUsage
public int getRilDataRadioTechnology() {
- return this.mRilDataRadioTechnology;
+ NetworkRegistrationInfo wwanRegInfo = getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ NetworkRegistrationInfo wlanRegInfo = getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN);
+ if (wlanRegInfo != null
+ && wlanRegInfo.getAccessNetworkTechnology() == TelephonyManager.NETWORK_TYPE_IWLAN
+ && wlanRegInfo.getRegistrationState()
+ == NetworkRegistrationInfo.REGISTRATION_STATE_HOME) {
+ return RIL_RADIO_TECHNOLOGY_IWLAN;
+ } else if (wwanRegInfo != null) {
+ return networkTypeToRilRadioTechnology(wwanRegInfo.getAccessNetworkTechnology());
+ }
+ return RIL_RADIO_TECHNOLOGY_UNKNOWN;
}
/**
* @hide
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 3d3ef98..e6e54ea 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1321,7 +1321,7 @@
/**
* An int extra used with {@link #ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED} to indicate the
- * subscription which has changed.
+ * subscription which has changed; or in general whenever a subscription ID needs specified.
*/
public static final String EXTRA_SUBSCRIPTION_ID = "android.telephony.extra.SUBSCRIPTION_ID";
@@ -1428,13 +1428,24 @@
/**
* Integer intent extra to be used with {@link #ACTION_PRIMARY_SUBSCRIPTION_LIST_CHANGED}
- * to indicate whether a SIM selection is needed to choose default subscription.
+ * to indicate what type of SIM selection is needed.
*
* @hide
*/
public static final String EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE =
"android.telephony.extra.DEFAULT_SUBSCRIPTION_SELECT_TYPE";
+ /** @hide */
+ @IntDef({
+ EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_NONE,
+ EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DATA,
+ EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_VOICE,
+ EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_SMS,
+ EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface DefaultSubscriptionSelectType{}
+
/**
* Used as an int value for {@link #EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE}
* to indicate there's no need to re-select any default subscription.
@@ -1466,20 +1477,11 @@
/**
* Used as an int value for {@link #EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE}
* to indicate user to decide whether current SIM should be preferred for all
- * data / voice / sms.
+ * data / voice / sms. {@link #EXTRA_SUBSCRIPTION_ID} will specified to indicate
+ * which subscription should be the default subscription.
* @hide
*/
- public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_FOR_ALL_TYPES = 4;
-
- /**
- * Integer intent extra to be used with
- * {@link #EXTRA_DEFAULT_SUBSCRIPTION_SELECT_FOR_ALL_TYPES}
- * to indicate which SIM is being selected.
- *
- * @hide
- */
- public static final String EXTRA_DEFAULT_SUBSCRIPTION_ID =
- "android.telephony.extra.DEFAULT_SUBSCRIPTION_ID";
+ public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL = 4;
//
//
@@ -5241,6 +5243,18 @@
* Use this method when no subscriptions are available on the SIM and the operation must be
* performed using the physical slot index.
*
+ * This operation wraps two APDU instructions:
+ * <ul>
+ * <li>MANAGE CHANNEL to open a logical channel</li>
+ * <li>SELECT the given {@code AID} using the given {@code p2}</li>
+ * </ul>
+ *
+ * Per Open Mobile API Specification v3.2 section 6.2.7.h, only p2 values of 0x00, 0x04, 0x08,
+ * and 0x0C are guaranteed to be supported.
+ *
+ * If the SELECT command's status word is not '9000', '62xx', or '63xx', the status word will be
+ * considered an error and the channel shall not be opened.
+ *
* Input parameters equivalent to TS 27.007 AT+CCHO command.
*
* <p>Requires Permission:
@@ -5272,6 +5286,18 @@
/**
* Opens a logical channel to the ICC card.
*
+ * This operation wraps two APDU instructions:
+ * <ul>
+ * <li>MANAGE CHANNEL to open a logical channel</li>
+ * <li>SELECT the given {@code AID} using the given {@code p2}</li>
+ * </ul>
+ *
+ * Per Open Mobile API Specification v3.2 section 6.2.7.h, only p2 values of 0x00, 0x04, 0x08,
+ * and 0x0C are guaranteed to be supported.
+ *
+ * If the SELECT command's status word is not '9000', '62xx', or '63xx', the status word will be
+ * considered an error and the channel shall not be opened.
+ *
* Input parameters equivalent to TS 27.007 AT+CCHO command.
*
* <p>Requires Permission:
@@ -5289,6 +5315,18 @@
/**
* Opens a logical channel to the ICC card.
*
+ * This operation wraps two APDU instructions:
+ * <ul>
+ * <li>MANAGE CHANNEL to open a logical channel</li>
+ * <li>SELECT the given {@code AID} using the given {@code p2}</li>
+ * </ul>
+ *
+ * Per Open Mobile API Specification v3.2 section 6.2.7.h, only p2 values of 0x00, 0x04, 0x08,
+ * and 0x0C are guaranteed to be supported.
+ *
+ * If the SELECT command's status word is not '9000', '62xx', or '63xx', the status word will be
+ * considered an error and the channel shall not be opened.
+ *
* Input parameters equivalent to TS 27.007 AT+CCHO command.
*
* <p>Requires Permission:
@@ -8911,6 +8949,27 @@
return retval;
}
+ /**
+ * Determines the {@link PhoneAccountHandle} associated with a subscription Id.
+ *
+ * @param subscriptionId The subscription Id to check.
+ * @return The {@link PhoneAccountHandle} associated with a subscription Id, or {@code null} if
+ * there is no associated {@link PhoneAccountHandle}.
+ * @hide
+ */
+ public @Nullable PhoneAccountHandle getPhoneAccountHandleForSubscriptionId(int subscriptionId) {
+ PhoneAccountHandle returnValue = null;
+ try {
+ ITelephony service = getITelephony();
+ if (service != null) {
+ returnValue = service.getPhoneAccountHandleForSubscriptionId(subscriptionId);
+ }
+ } catch (RemoteException e) {
+ }
+
+ return returnValue;
+ }
+
private int getSubIdForPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) {
int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
try {
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index c8dab27..26d0c82 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1265,6 +1265,11 @@
*/
int getSubIdForPhoneAccount(in PhoneAccount phoneAccount);
+ /**
+ * Returns the PhoneAccountHandle associated with a subscription ID.
+ */
+ PhoneAccountHandle getPhoneAccountHandleForSubscriptionId(int subscriptionId);
+
void factoryReset(int subId);
/**
diff --git a/tests/net/Android.bp b/tests/net/Android.bp
index 1c86983..45eeb2a 100644
--- a/tests/net/Android.bp
+++ b/tests/net/Android.bp
@@ -4,6 +4,7 @@
java_defaults {
name: "FrameworksNetTests-jni-defaults",
static_libs: [
+ "FrameworksNetCommonTests",
"frameworks-base-testutils",
"framework-protos",
"androidx.test.rules",
diff --git a/tests/net/common/Android.bp b/tests/net/common/Android.bp
new file mode 100644
index 0000000..0a1ac75
--- /dev/null
+++ b/tests/net/common/Android.bp
@@ -0,0 +1,29 @@
+//
+// 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.
+//
+
+// Tests in this folder are included both in unit tests and CTS.
+// They must be fast and stable, and exercise public or test APIs.
+java_library {
+ name: "FrameworksNetCommonTests",
+ srcs: ["java/**/*.java"],
+ static_libs: [
+ "androidx.test.rules",
+ "junit",
+ ],
+ libs: [
+ "android.test.base.stubs",
+ ],
+}
\ No newline at end of file
diff --git a/tests/net/java/android/net/IpPrefixTest.java b/tests/net/common/java/android/net/IpPrefixTest.java
similarity index 84%
rename from tests/net/java/android/net/IpPrefixTest.java
rename to tests/net/common/java/android/net/IpPrefixTest.java
index abf019a..719960d 100644
--- a/tests/net/java/android/net/IpPrefixTest.java
+++ b/tests/net/common/java/android/net/IpPrefixTest.java
@@ -39,7 +39,7 @@
@SmallTest
public class IpPrefixTest {
- private static InetAddress Address(String addr) {
+ private static InetAddress address(String addr) {
return InetAddress.parseNumericAddress(addr);
}
@@ -58,59 +58,59 @@
try {
p = new IpPrefix((byte[]) null, 9);
fail("Expected NullPointerException: null byte array");
- } catch(RuntimeException expected) {}
+ } catch (RuntimeException expected) { }
try {
p = new IpPrefix((InetAddress) null, 10);
fail("Expected NullPointerException: null InetAddress");
- } catch(RuntimeException expected) {}
+ } catch (RuntimeException expected) { }
try {
p = new IpPrefix((String) null);
fail("Expected NullPointerException: null String");
- } catch(RuntimeException expected) {}
+ } catch (RuntimeException expected) { }
try {
byte[] b2 = {1, 2, 3, 4, 5};
p = new IpPrefix(b2, 29);
fail("Expected IllegalArgumentException: invalid array length");
- } catch(IllegalArgumentException expected) {}
+ } catch (IllegalArgumentException expected) { }
try {
p = new IpPrefix("1.2.3.4");
fail("Expected IllegalArgumentException: no prefix length");
- } catch(IllegalArgumentException expected) {}
+ } catch (IllegalArgumentException expected) { }
try {
p = new IpPrefix("1.2.3.4/");
fail("Expected IllegalArgumentException: empty prefix length");
- } catch(IllegalArgumentException expected) {}
+ } catch (IllegalArgumentException expected) { }
try {
p = new IpPrefix("foo/32");
fail("Expected IllegalArgumentException: invalid address");
- } catch(IllegalArgumentException expected) {}
+ } catch (IllegalArgumentException expected) { }
try {
p = new IpPrefix("1/32");
fail("Expected IllegalArgumentException: deprecated IPv4 format");
- } catch(IllegalArgumentException expected) {}
+ } catch (IllegalArgumentException expected) { }
try {
p = new IpPrefix("1.2.3.256/32");
fail("Expected IllegalArgumentException: invalid IPv4 address");
- } catch(IllegalArgumentException expected) {}
+ } catch (IllegalArgumentException expected) { }
try {
p = new IpPrefix("foo/32");
fail("Expected IllegalArgumentException: non-address");
- } catch(IllegalArgumentException expected) {}
+ } catch (IllegalArgumentException expected) { }
try {
p = new IpPrefix("f00:::/32");
fail("Expected IllegalArgumentException: invalid IPv6 address");
- } catch(IllegalArgumentException expected) {}
+ } catch (IllegalArgumentException expected) { }
}
@Test
@@ -132,17 +132,17 @@
try {
p = new IpPrefix(IPV4_BYTES, 33);
fail("Expected IllegalArgumentException: invalid prefix length");
- } catch(RuntimeException expected) {}
+ } catch (RuntimeException expected) { }
try {
p = new IpPrefix(IPV4_BYTES, 128);
fail("Expected IllegalArgumentException: invalid prefix length");
- } catch(RuntimeException expected) {}
+ } catch (RuntimeException expected) { }
try {
p = new IpPrefix(IPV4_BYTES, -1);
fail("Expected IllegalArgumentException: negative prefix length");
- } catch(RuntimeException expected) {}
+ } catch (RuntimeException expected) { }
p = new IpPrefix(IPV6_BYTES, 128);
assertEquals("2001:db8:dead:beef:f00::a0/128", p.toString());
@@ -162,12 +162,12 @@
try {
p = new IpPrefix(IPV6_BYTES, -1);
fail("Expected IllegalArgumentException: negative prefix length");
- } catch(RuntimeException expected) {}
+ } catch (RuntimeException expected) { }
try {
p = new IpPrefix(IPV6_BYTES, 129);
fail("Expected IllegalArgumentException: negative prefix length");
- } catch(RuntimeException expected) {}
+ } catch (RuntimeException expected) { }
}
@@ -226,28 +226,28 @@
@Test
public void testContainsInetAddress() {
IpPrefix p = new IpPrefix("2001:db8:f00::ace:d00d/127");
- assertTrue(p.contains(Address("2001:db8:f00::ace:d00c")));
- assertTrue(p.contains(Address("2001:db8:f00::ace:d00d")));
- assertFalse(p.contains(Address("2001:db8:f00::ace:d00e")));
- assertFalse(p.contains(Address("2001:db8:f00::bad:d00d")));
- assertFalse(p.contains(Address("2001:4868:4860::8888")));
- assertFalse(p.contains(Address("8.8.8.8")));
+ assertTrue(p.contains(address("2001:db8:f00::ace:d00c")));
+ assertTrue(p.contains(address("2001:db8:f00::ace:d00d")));
+ assertFalse(p.contains(address("2001:db8:f00::ace:d00e")));
+ assertFalse(p.contains(address("2001:db8:f00::bad:d00d")));
+ assertFalse(p.contains(address("2001:4868:4860::8888")));
+ assertFalse(p.contains(address("8.8.8.8")));
p = new IpPrefix("192.0.2.0/23");
- assertTrue(p.contains(Address("192.0.2.43")));
- assertTrue(p.contains(Address("192.0.3.21")));
- assertFalse(p.contains(Address("192.0.0.21")));
- assertFalse(p.contains(Address("8.8.8.8")));
- assertFalse(p.contains(Address("2001:4868:4860::8888")));
+ assertTrue(p.contains(address("192.0.2.43")));
+ assertTrue(p.contains(address("192.0.3.21")));
+ assertFalse(p.contains(address("192.0.0.21")));
+ assertFalse(p.contains(address("8.8.8.8")));
+ assertFalse(p.contains(address("2001:4868:4860::8888")));
IpPrefix ipv6Default = new IpPrefix("::/0");
- assertTrue(ipv6Default.contains(Address("2001:db8::f00")));
- assertFalse(ipv6Default.contains(Address("192.0.2.1")));
+ assertTrue(ipv6Default.contains(address("2001:db8::f00")));
+ assertFalse(ipv6Default.contains(address("192.0.2.1")));
IpPrefix ipv4Default = new IpPrefix("0.0.0.0/0");
- assertTrue(ipv4Default.contains(Address("255.255.255.255")));
- assertTrue(ipv4Default.contains(Address("192.0.2.1")));
- assertFalse(ipv4Default.contains(Address("2001:db8::f00")));
+ assertTrue(ipv4Default.contains(address("255.255.255.255")));
+ assertTrue(ipv4Default.contains(address("192.0.2.1")));
+ assertFalse(ipv4Default.contains(address("2001:db8::f00")));
}
@Test
@@ -315,10 +315,10 @@
p = new IpPrefix(b, random.nextInt(129));
}
if (p.equals(oldP)) {
- assertEquals(p.hashCode(), oldP.hashCode());
+ assertEquals(p.hashCode(), oldP.hashCode());
}
if (p.hashCode() != oldP.hashCode()) {
- assertNotEquals(p, oldP);
+ assertNotEquals(p, oldP);
}
}
}
@@ -332,9 +332,9 @@
new IpPrefix("0.0.0.0/0"),
};
for (int i = 0; i < prefixes.length; i++) {
- for (int j = i + 1; j < prefixes.length; j++) {
- assertNotEquals(prefixes[i].hashCode(), prefixes[j].hashCode());
- }
+ for (int j = i + 1; j < prefixes.length; j++) {
+ assertNotEquals(prefixes[i].hashCode(), prefixes[j].hashCode());
+ }
}
}
@@ -371,8 +371,8 @@
}
public void assertParcelingIsLossless(IpPrefix p) {
- IpPrefix p2 = passThroughParcel(p);
- assertEquals(p, p2);
+ IpPrefix p2 = passThroughParcel(p);
+ assertEquals(p, p2);
}
@Test
diff --git a/tests/net/java/android/net/netlink/InetDiagSocketTest.java b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
index b6038ab..8b2b4e3 100644
--- a/tests/net/java/android/net/netlink/InetDiagSocketTest.java
+++ b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
@@ -189,7 +189,6 @@
udp.close();
}
- @Test
public void testGetConnectionOwnerUid() throws Exception {
checkGetConnectionOwnerUid("::", null);
checkGetConnectionOwnerUid("::", "::");
diff --git a/tests/net/java/com/android/server/IpSecServiceTest.java b/tests/net/java/com/android/server/IpSecServiceTest.java
index b5c3e92..4a35015 100644
--- a/tests/net/java/com/android/server/IpSecServiceTest.java
+++ b/tests/net/java/com/android/server/IpSecServiceTest.java
@@ -156,10 +156,21 @@
@Test
public void testOpenAndCloseUdpEncapsulationSocket() throws Exception {
- int localport = findUnusedPort();
+ int localport = -1;
+ IpSecUdpEncapResponse udpEncapResp = null;
- IpSecUdpEncapResponse udpEncapResp =
- mIpSecService.openUdpEncapsulationSocket(localport, new Binder());
+ for (int i = 0; i < IpSecService.MAX_PORT_BIND_ATTEMPTS; i++) {
+ localport = findUnusedPort();
+
+ udpEncapResp = mIpSecService.openUdpEncapsulationSocket(localport, new Binder());
+ assertNotNull(udpEncapResp);
+ if (udpEncapResp.status == IpSecManager.Status.OK) {
+ break;
+ }
+
+ // Else retry to reduce possibility for port-bind failures.
+ }
+
assertNotNull(udpEncapResp);
assertEquals(IpSecManager.Status.OK, udpEncapResp.status);
assertEquals(localport, udpEncapResp.port);
@@ -204,12 +215,11 @@
@Test
public void testOpenUdpEncapsulationSocketAfterClose() throws Exception {
- int localport = findUnusedPort();
IpSecUdpEncapResponse udpEncapResp =
- mIpSecService.openUdpEncapsulationSocket(localport, new Binder());
+ mIpSecService.openUdpEncapsulationSocket(0, new Binder());
assertNotNull(udpEncapResp);
assertEquals(IpSecManager.Status.OK, udpEncapResp.status);
- assertEquals(localport, udpEncapResp.port);
+ int localport = udpEncapResp.port;
mIpSecService.closeUdpEncapsulationSocket(udpEncapResp.resourceId);
udpEncapResp.fileDescriptor.close();
@@ -226,12 +236,11 @@
*/
@Test
public void testUdpEncapPortNotReleased() throws Exception {
- int localport = findUnusedPort();
IpSecUdpEncapResponse udpEncapResp =
- mIpSecService.openUdpEncapsulationSocket(localport, new Binder());
+ mIpSecService.openUdpEncapsulationSocket(0, new Binder());
assertNotNull(udpEncapResp);
assertEquals(IpSecManager.Status.OK, udpEncapResp.status);
- assertEquals(localport, udpEncapResp.port);
+ int localport = udpEncapResp.port;
udpEncapResp.fileDescriptor.close();
@@ -273,14 +282,11 @@
@Test
public void testOpenUdpEncapsulationSocketTwice() throws Exception {
- int localport = findUnusedPort();
-
IpSecUdpEncapResponse udpEncapResp =
- mIpSecService.openUdpEncapsulationSocket(localport, new Binder());
+ mIpSecService.openUdpEncapsulationSocket(0, new Binder());
assertNotNull(udpEncapResp);
assertEquals(IpSecManager.Status.OK, udpEncapResp.status);
- assertEquals(localport, udpEncapResp.port);
- mIpSecService.openUdpEncapsulationSocket(localport, new Binder());
+ int localport = udpEncapResp.port;
IpSecUdpEncapResponse testUdpEncapResp =
mIpSecService.openUdpEncapsulationSocket(localport, new Binder());