diff options
173 files changed, 200 insertions, 7320 deletions
diff --git a/core/java/android/net/MacAddress.java b/core/java/android/net/MacAddress.java index a809b28c9204..2cf2a6514e77 100644 --- a/core/java/android/net/MacAddress.java +++ b/core/java/android/net/MacAddress.java @@ -85,6 +85,9 @@ public final class MacAddress implements Parcelable { private static final long OUI_MASK = MacAddress.fromString("ff:ff:ff:0:0:0").mAddr; private static final long NIC_MASK = MacAddress.fromString("0:0:0:ff:ff:ff").mAddr; private static final MacAddress BASE_GOOGLE_MAC = MacAddress.fromString("da:a1:19:0:0:0"); + /** Default wifi MAC address used for a special purpose **/ + private static final MacAddress DEFAULT_MAC_ADDRESS = + MacAddress.fromString(WifiInfo.DEFAULT_MAC_ADDRESS); // Internal representation of the MAC address as a single 8 byte long. // The encoding scheme sets the two most significant bytes to 0. The 6 bytes of the @@ -361,16 +364,7 @@ public final class MacAddress implements Parcelable { * @hide */ public static @NonNull MacAddress createRandomUnicastAddress() { - SecureRandom r = new SecureRandom(); - long addr = r.nextLong() & VALID_LONG_MASK; - addr |= LOCALLY_ASSIGNED_MASK; - addr &= ~MULTICAST_MASK; - MacAddress mac = new MacAddress(addr); - // WifiInfo.DEFAULT_MAC_ADDRESS is being used for another purpose, so do not use it here. - if (mac.toString().equals(WifiInfo.DEFAULT_MAC_ADDRESS)) { - return createRandomUnicastAddress(); - } - return mac; + return createRandomUnicastAddress(null, new SecureRandom()); } /** @@ -380,18 +374,23 @@ public final class MacAddress implements Parcelable { * The locally assigned bit is always set to 1. The multicast bit is always set to 0. * * @param base a base MacAddress whose OUI is used for generating the random address. + * If base == null then the OUI will also be randomized. * @param r a standard Java Random object used for generating the random address. * @return a random locally assigned MacAddress. * * @hide */ public static @NonNull MacAddress createRandomUnicastAddress(MacAddress base, Random r) { - long addr = (base.mAddr & OUI_MASK) | (NIC_MASK & r.nextLong()); + long addr; + if (base == null) { + addr = r.nextLong() & VALID_LONG_MASK; + } else { + addr = (base.mAddr & OUI_MASK) | (NIC_MASK & r.nextLong()); + } addr |= LOCALLY_ASSIGNED_MASK; addr &= ~MULTICAST_MASK; MacAddress mac = new MacAddress(addr); - // WifiInfo.DEFAULT_MAC_ADDRESS is being used for another purpose, so do not use it here. - if (mac.toString().equals(WifiInfo.DEFAULT_MAC_ADDRESS)) { + if (mac.equals(DEFAULT_MAC_ADDRESS)) { return createRandomUnicastAddress(base, r); } return mac; diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java index 7bf1c4b68390..a6e5972faa55 100644 --- a/core/java/android/os/SystemProperties.java +++ b/core/java/android/os/SystemProperties.java @@ -39,6 +39,13 @@ import java.util.HashMap; * Gives access to the system properties store. The system properties * store contains a list of string key-value pairs. * + * <p>Use this class only for the system properties that are local. e.g., within + * an app, a partition, or a module. For system properties used across the + * boundaries, formally define them in <code>*.sysprop</code> files and use the + * auto-generated methods. For more information, see <a href= + * "https://source.android.com/devices/architecture/sysprops-apis">Implementing + * System Properties as APIs</a>.</p> + * * {@hide} */ @SystemApi diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 92ac95d4cf07..df481cf16f41 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -1169,6 +1169,12 @@ void AndroidRuntime::start(const char* className, const Vector<String8>& options return; } + const char* i18nRootDir = getenv("ANDROID_I18N_ROOT"); + if (i18nRootDir == NULL) { + LOG_FATAL("No runtime directory specified with ANDROID_I18N_ROOT environment variable."); + return; + } + const char* tzdataRootDir = getenv("ANDROID_TZDATA_ROOT"); if (tzdataRootDir == NULL) { LOG_FATAL("No tz data directory specified with ANDROID_TZDATA_ROOT environment variable."); diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index f7e825eecc12..9c896abd5567 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -285,11 +285,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } case MSG_UPDATE_DEFAULT_SUB: { int newDefaultPhoneId = msg.arg1; - int newDefaultSubId = (Integer)(msg.obj); + int newDefaultSubId = msg.arg2; if (VDBG) { log("MSG_UPDATE_DEFAULT_SUB:current mDefaultSubId=" + mDefaultSubId - + " current mDefaultPhoneId=" + mDefaultPhoneId + " newDefaultSubId= " - + newDefaultSubId + " newDefaultPhoneId=" + newDefaultPhoneId); + + " current mDefaultPhoneId=" + mDefaultPhoneId + + " newDefaultSubId=" + newDefaultSubId + + " newDefaultPhoneId=" + newDefaultPhoneId); } //Due to possible risk condition,(notify call back using the new @@ -306,7 +307,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { mDefaultSubId = newDefaultSubId; mDefaultPhoneId = newDefaultPhoneId; mLocalLog.log("Default subscription updated: mDefaultPhoneId=" - + mDefaultPhoneId + ", mDefaultSubId" + mDefaultSubId); + + mDefaultPhoneId + ", mDefaultSubId=" + mDefaultSubId); } } } @@ -336,22 +337,25 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { int userHandle = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0); if (DBG) log("onReceive: userHandle=" + userHandle); mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCHED, userHandle, 0)); - } else if (action.equals(TelephonyIntents.ACTION_DEFAULT_SUBSCRIPTION_CHANGED)) { - Integer newDefaultSubIdObj = new Integer(intent.getIntExtra( - PhoneConstants.SUBSCRIPTION_KEY, - SubscriptionManager.getDefaultSubscriptionId())); - int newDefaultPhoneId = intent.getIntExtra(PhoneConstants.PHONE_KEY, - SubscriptionManager.getPhoneId(mDefaultSubId)); + } else if (action.equals(SubscriptionManager.ACTION_DEFAULT_SUBSCRIPTION_CHANGED)) { + int newDefaultSubId = intent.getIntExtra( + SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, + SubscriptionManager.getDefaultSubscriptionId()); + int newDefaultPhoneId = intent.getIntExtra( + PhoneConstants.PHONE_KEY, + SubscriptionManager.getPhoneId(newDefaultSubId)); if (DBG) { log("onReceive:current mDefaultSubId=" + mDefaultSubId - + " current mDefaultPhoneId=" + mDefaultPhoneId + " newDefaultSubId= " - + newDefaultSubIdObj + " newDefaultPhoneId=" + newDefaultPhoneId); + + " current mDefaultPhoneId=" + mDefaultPhoneId + + " newDefaultSubId=" + newDefaultSubId + + " newDefaultPhoneId=" + newDefaultPhoneId); } - if(validatePhoneId(newDefaultPhoneId) && (!newDefaultSubIdObj.equals(mDefaultSubId) - || (newDefaultPhoneId != mDefaultPhoneId))) { + if (validatePhoneId(newDefaultPhoneId) + && (newDefaultSubId != mDefaultSubId + || newDefaultPhoneId != mDefaultPhoneId)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_UPDATE_DEFAULT_SUB, - newDefaultPhoneId, 0, newDefaultSubIdObj)); + newDefaultPhoneId, newDefaultSubId)); } } } @@ -450,7 +454,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { final IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_SWITCHED); filter.addAction(Intent.ACTION_USER_REMOVED); - filter.addAction(TelephonyIntents.ACTION_DEFAULT_SUBSCRIPTION_CHANGED); + filter.addAction(SubscriptionManager.ACTION_DEFAULT_SUBSCRIPTION_CHANGED); log("systemRunning register for intents"); mContext.registerReceiver(mBroadcastReceiver, filter); } diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java index 7569363a7134..a35d2ee38641 100644 --- a/services/core/java/com/android/server/appop/AppOpsService.java +++ b/services/core/java/com/android/server/appop/AppOpsService.java @@ -705,7 +705,12 @@ public class AppOpsService extends IAppOpsService.Stub { public void binderDied() { synchronized (AppOpsService.this) { for (int i=mStartedOps.size()-1; i>=0; i--) { - finishOperationLocked(mStartedOps.get(i), /*finishNested*/ true); + final Op op = mStartedOps.get(i); + finishOperationLocked(op, /*finishNested*/ true); + if (op.startNesting <= 0) { + scheduleOpActiveChangedIfNeededLocked(op.op, op.uidState.uid, + op.packageName, false); + } } mClients.remove(mAppToken); } diff --git a/services/net/Android.bp b/services/net/Android.bp index 8f8f9f9bbf55..1ca96ed80e5e 100644 --- a/services/net/Android.bp +++ b/services/net/Android.bp @@ -1,87 +1,10 @@ -// AIDL interfaces between the core system and the networking mainline module. -aidl_interface { - name: "ipmemorystore-aidl-interfaces", - local_include_dir: "java", - srcs: [ - "java/android/net/IIpMemoryStore.aidl", - "java/android/net/IIpMemoryStoreCallbacks.aidl", - "java/android/net/ipmemorystore/**/*.aidl", - ], - backend: { - ndk: { - enabled: false, - }, - cpp: { - enabled: false, - }, - }, - api_dir: "aidl/ipmemorystore", - versions: [ - "1", - "2", - "3", - ], -} - -aidl_interface { - name: "networkstack-aidl-interfaces", - local_include_dir: "java", - include_dirs: ["frameworks/base/core/java"], // For framework parcelables. - srcs: [ - "java/android/net/DhcpResultsParcelable.aidl", - "java/android/net/INetworkMonitor.aidl", - "java/android/net/INetworkMonitorCallbacks.aidl", - "java/android/net/INetworkStackConnector.aidl", - "java/android/net/INetworkStackStatusCallback.aidl", - "java/android/net/InitialConfigurationParcelable.aidl", - "java/android/net/NattKeepalivePacketDataParcelable.aidl", - "java/android/net/PrivateDnsConfigParcel.aidl", - "java/android/net/ProvisioningConfigurationParcelable.aidl", - "java/android/net/TcpKeepalivePacketDataParcelable.aidl", - "java/android/net/dhcp/DhcpServingParamsParcel.aidl", - "java/android/net/dhcp/IDhcpServer.aidl", - "java/android/net/dhcp/IDhcpServerCallbacks.aidl", - "java/android/net/ip/IIpClient.aidl", - "java/android/net/ip/IIpClientCallbacks.aidl", - ], - backend: { - ndk: { - enabled: false, - }, - cpp: { - enabled: false, - }, - }, - api_dir: "aidl/networkstack", - imports: ["ipmemorystore-aidl-interfaces"], - versions: [ - "1", - "2", - "3", - ], -} - java_library_static { name: "services.net", srcs: ["java/**/*.java"], static_libs: [ "dnsresolver_aidl_interface-V2-java", - "ipmemorystore-client", "netd_aidl_interface-java", - "networkstack-aidl-interfaces-V3-java", - ], -} - -java_library_static { - name: "ipmemorystore-client", - sdk_version: "system_current", - srcs: [ - ":framework-annotations", - "java/android/net/IpMemoryStoreClient.java", - "java/android/net/ipmemorystore/**/*.java", - ], - static_libs: [ - "ipmemorystore-aidl-interfaces-V3-java", + "networkstack-client", ], } diff --git a/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStore.aidl b/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStore.aidl deleted file mode 100644 index a8cbab26190f..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStore.aidl +++ /dev/null @@ -1,9 +0,0 @@ -package android.net; -interface IIpMemoryStore { - oneway void storeNetworkAttributes(String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnStatusListener listener); - oneway void storeBlob(String l2Key, String clientId, String name, in android.net.ipmemorystore.Blob data, android.net.ipmemorystore.IOnStatusListener listener); - oneway void findL2Key(in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnL2KeyResponseListener listener); - oneway void isSameNetwork(String l2Key1, String l2Key2, android.net.ipmemorystore.IOnSameL3NetworkResponseListener listener); - oneway void retrieveNetworkAttributes(String l2Key, android.net.ipmemorystore.IOnNetworkAttributesRetrievedListener listener); - oneway void retrieveBlob(String l2Key, String clientId, String name, android.net.ipmemorystore.IOnBlobRetrievedListener listener); -} diff --git a/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStoreCallbacks.aidl deleted file mode 100644 index cf02c26c2fe3..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStoreCallbacks.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net; -interface IIpMemoryStoreCallbacks { - oneway void onIpMemoryStoreFetched(in android.net.IIpMemoryStore ipMemoryStore); -} diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/Blob.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/Blob.aidl deleted file mode 100644 index 291dbef817e6..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/Blob.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -parcelable Blob { - byte[] data; -} diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl deleted file mode 100644 index 52f40d49abd5..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -interface IOnBlobRetrievedListener { - oneway void onBlobRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in String name, in android.net.ipmemorystore.Blob data); -} diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl deleted file mode 100644 index 785351435d73..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -interface IOnL2KeyResponseListener { - oneway void onL2KeyResponse(in android.net.ipmemorystore.StatusParcelable status, in String l2Key); -} diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl deleted file mode 100644 index 3dd2ae6e9bab..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -interface IOnNetworkAttributesRetrievedListener { - oneway void onNetworkAttributesRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes); -} diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl deleted file mode 100644 index 46d4ecb9ed7c..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -interface IOnSameL3NetworkResponseListener { - oneway void onSameL3NetworkResponse(in android.net.ipmemorystore.StatusParcelable status, in android.net.ipmemorystore.SameL3NetworkResponseParcelable response); -} diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnStatusListener.aidl deleted file mode 100644 index 54e654b80c9e..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnStatusListener.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -interface IOnStatusListener { - oneway void onComplete(in android.net.ipmemorystore.StatusParcelable status); -} diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/NetworkAttributesParcelable.aidl deleted file mode 100644 index 9531ea3963fb..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/NetworkAttributesParcelable.aidl +++ /dev/null @@ -1,8 +0,0 @@ -package android.net.ipmemorystore; -parcelable NetworkAttributesParcelable { - byte[] assignedV4Address; - long assignedV4AddressExpiry; - String groupHint; - android.net.ipmemorystore.Blob[] dnsAddresses; - int mtu; -} diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl deleted file mode 100644 index 414272b49f1d..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl +++ /dev/null @@ -1,6 +0,0 @@ -package android.net.ipmemorystore; -parcelable SameL3NetworkResponseParcelable { - String l2Key1; - String l2Key2; - float confidence; -} diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/StatusParcelable.aidl deleted file mode 100644 index 92c6779b5dc0..000000000000 --- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/StatusParcelable.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -parcelable StatusParcelable { - int resultCode; -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStore.aidl b/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStore.aidl deleted file mode 100644 index a8cbab26190f..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStore.aidl +++ /dev/null @@ -1,9 +0,0 @@ -package android.net; -interface IIpMemoryStore { - oneway void storeNetworkAttributes(String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnStatusListener listener); - oneway void storeBlob(String l2Key, String clientId, String name, in android.net.ipmemorystore.Blob data, android.net.ipmemorystore.IOnStatusListener listener); - oneway void findL2Key(in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnL2KeyResponseListener listener); - oneway void isSameNetwork(String l2Key1, String l2Key2, android.net.ipmemorystore.IOnSameL3NetworkResponseListener listener); - oneway void retrieveNetworkAttributes(String l2Key, android.net.ipmemorystore.IOnNetworkAttributesRetrievedListener listener); - oneway void retrieveBlob(String l2Key, String clientId, String name, android.net.ipmemorystore.IOnBlobRetrievedListener listener); -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStoreCallbacks.aidl deleted file mode 100644 index cf02c26c2fe3..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStoreCallbacks.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net; -interface IIpMemoryStoreCallbacks { - oneway void onIpMemoryStoreFetched(in android.net.IIpMemoryStore ipMemoryStore); -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/Blob.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/Blob.aidl deleted file mode 100644 index 291dbef817e6..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/Blob.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -parcelable Blob { - byte[] data; -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl deleted file mode 100644 index 52f40d49abd5..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -interface IOnBlobRetrievedListener { - oneway void onBlobRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in String name, in android.net.ipmemorystore.Blob data); -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl deleted file mode 100644 index 785351435d73..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -interface IOnL2KeyResponseListener { - oneway void onL2KeyResponse(in android.net.ipmemorystore.StatusParcelable status, in String l2Key); -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl deleted file mode 100644 index 3dd2ae6e9bab..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -interface IOnNetworkAttributesRetrievedListener { - oneway void onNetworkAttributesRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes); -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl deleted file mode 100644 index 46d4ecb9ed7c..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -interface IOnSameL3NetworkResponseListener { - oneway void onSameL3NetworkResponse(in android.net.ipmemorystore.StatusParcelable status, in android.net.ipmemorystore.SameL3NetworkResponseParcelable response); -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnStatusListener.aidl deleted file mode 100644 index 54e654b80c9e..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnStatusListener.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -interface IOnStatusListener { - oneway void onComplete(in android.net.ipmemorystore.StatusParcelable status); -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/NetworkAttributesParcelable.aidl deleted file mode 100644 index 9531ea3963fb..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/NetworkAttributesParcelable.aidl +++ /dev/null @@ -1,8 +0,0 @@ -package android.net.ipmemorystore; -parcelable NetworkAttributesParcelable { - byte[] assignedV4Address; - long assignedV4AddressExpiry; - String groupHint; - android.net.ipmemorystore.Blob[] dnsAddresses; - int mtu; -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl deleted file mode 100644 index 414272b49f1d..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl +++ /dev/null @@ -1,6 +0,0 @@ -package android.net.ipmemorystore; -parcelable SameL3NetworkResponseParcelable { - String l2Key1; - String l2Key2; - float confidence; -} diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/StatusParcelable.aidl deleted file mode 100644 index 92c6779b5dc0..000000000000 --- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/StatusParcelable.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.ipmemorystore; -parcelable StatusParcelable { - int resultCode; -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl deleted file mode 100644 index 30893b215001..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -interface IIpMemoryStore { - oneway void storeNetworkAttributes(String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnStatusListener listener); - oneway void storeBlob(String l2Key, String clientId, String name, in android.net.ipmemorystore.Blob data, android.net.ipmemorystore.IOnStatusListener listener); - oneway void findL2Key(in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnL2KeyResponseListener listener); - oneway void isSameNetwork(String l2Key1, String l2Key2, android.net.ipmemorystore.IOnSameL3NetworkResponseListener listener); - oneway void retrieveNetworkAttributes(String l2Key, android.net.ipmemorystore.IOnNetworkAttributesRetrievedListener listener); - oneway void retrieveBlob(String l2Key, String clientId, String name, android.net.ipmemorystore.IOnBlobRetrievedListener listener); - oneway void factoryReset(); -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl deleted file mode 100644 index 535ae2cf25e4..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -interface IIpMemoryStoreCallbacks { - oneway void onIpMemoryStoreFetched(in android.net.IIpMemoryStore ipMemoryStore); -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl deleted file mode 100644 index 6d2dc0ccaaac..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ipmemorystore; -parcelable Blob { - byte[] data; -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl deleted file mode 100644 index 48c1fb8c180a..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ipmemorystore; -interface IOnBlobRetrievedListener { - oneway void onBlobRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in String name, in android.net.ipmemorystore.Blob data); -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl deleted file mode 100644 index aebc7240bc9e..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ipmemorystore; -interface IOnL2KeyResponseListener { - oneway void onL2KeyResponse(in android.net.ipmemorystore.StatusParcelable status, in String l2Key); -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl deleted file mode 100644 index b66db5ab21cb..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ipmemorystore; -interface IOnNetworkAttributesRetrievedListener { - oneway void onNetworkAttributesRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes); -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl deleted file mode 100644 index e9f2db445d38..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ipmemorystore; -interface IOnSameL3NetworkResponseListener { - oneway void onSameL3NetworkResponse(in android.net.ipmemorystore.StatusParcelable status, in android.net.ipmemorystore.SameL3NetworkResponseParcelable response); -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl deleted file mode 100644 index 49172cea9587..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ipmemorystore; -interface IOnStatusListener { - oneway void onComplete(in android.net.ipmemorystore.StatusParcelable status); -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl deleted file mode 100644 index 188db20b531a..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ipmemorystore; -parcelable NetworkAttributesParcelable { - byte[] assignedV4Address; - long assignedV4AddressExpiry; - String groupHint; - android.net.ipmemorystore.Blob[] dnsAddresses; - int mtu; -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl deleted file mode 100644 index 7a2ed48241e7..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ipmemorystore; -parcelable SameL3NetworkResponseParcelable { - String l2Key1; - String l2Key2; - float confidence; -} diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl deleted file mode 100644 index d9b067875e84..000000000000 --- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ipmemorystore; -parcelable StatusParcelable { - int resultCode; -} diff --git a/services/net/aidl/networkstack/1/android/net/DhcpResultsParcelable.aidl b/services/net/aidl/networkstack/1/android/net/DhcpResultsParcelable.aidl deleted file mode 100644 index 92b5345ee221..000000000000 --- a/services/net/aidl/networkstack/1/android/net/DhcpResultsParcelable.aidl +++ /dev/null @@ -1,8 +0,0 @@ -package android.net; -parcelable DhcpResultsParcelable { - android.net.StaticIpConfiguration baseConfiguration; - int leaseDuration; - int mtu; - String serverAddress; - String vendorInfo; -} diff --git a/services/net/aidl/networkstack/1/android/net/INetworkMonitor.aidl b/services/net/aidl/networkstack/1/android/net/INetworkMonitor.aidl deleted file mode 100644 index b19f522880ec..000000000000 --- a/services/net/aidl/networkstack/1/android/net/INetworkMonitor.aidl +++ /dev/null @@ -1,17 +0,0 @@ -package android.net; -interface INetworkMonitor { - oneway void start(); - oneway void launchCaptivePortalApp(); - oneway void notifyCaptivePortalAppFinished(int response); - oneway void setAcceptPartialConnectivity(); - oneway void forceReevaluation(int uid); - oneway void notifyPrivateDnsChanged(in android.net.PrivateDnsConfigParcel config); - oneway void notifyDnsResponse(int returnCode); - oneway void notifyNetworkConnected(in android.net.LinkProperties lp, in android.net.NetworkCapabilities nc); - oneway void notifyNetworkDisconnected(); - oneway void notifyLinkPropertiesChanged(in android.net.LinkProperties lp); - oneway void notifyNetworkCapabilitiesChanged(in android.net.NetworkCapabilities nc); - const int NETWORK_TEST_RESULT_VALID = 0; - const int NETWORK_TEST_RESULT_INVALID = 1; - const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2; -} diff --git a/services/net/aidl/networkstack/1/android/net/INetworkMonitorCallbacks.aidl b/services/net/aidl/networkstack/1/android/net/INetworkMonitorCallbacks.aidl deleted file mode 100644 index ee9871ddcd15..000000000000 --- a/services/net/aidl/networkstack/1/android/net/INetworkMonitorCallbacks.aidl +++ /dev/null @@ -1,8 +0,0 @@ -package android.net; -interface INetworkMonitorCallbacks { - oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor); - oneway void notifyNetworkTested(int testResult, @nullable String redirectUrl); - oneway void notifyPrivateDnsConfigResolved(in android.net.PrivateDnsConfigParcel config); - oneway void showProvisioningNotification(String action, String packageName); - oneway void hideProvisioningNotification(); -} diff --git a/services/net/aidl/networkstack/1/android/net/INetworkStackConnector.aidl b/services/net/aidl/networkstack/1/android/net/INetworkStackConnector.aidl deleted file mode 100644 index 7da11e476c0e..000000000000 --- a/services/net/aidl/networkstack/1/android/net/INetworkStackConnector.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package android.net; -interface INetworkStackConnector { - oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb); - oneway void makeNetworkMonitor(in android.net.Network network, String name, in android.net.INetworkMonitorCallbacks cb); - oneway void makeIpClient(in String ifName, in android.net.ip.IIpClientCallbacks callbacks); - oneway void fetchIpMemoryStore(in android.net.IIpMemoryStoreCallbacks cb); -} diff --git a/services/net/aidl/networkstack/1/android/net/INetworkStackStatusCallback.aidl b/services/net/aidl/networkstack/1/android/net/INetworkStackStatusCallback.aidl deleted file mode 100644 index f6ca6f7a78e2..000000000000 --- a/services/net/aidl/networkstack/1/android/net/INetworkStackStatusCallback.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net; -interface INetworkStackStatusCallback { - oneway void onStatusAvailable(int statusCode); -} diff --git a/services/net/aidl/networkstack/1/android/net/InitialConfigurationParcelable.aidl b/services/net/aidl/networkstack/1/android/net/InitialConfigurationParcelable.aidl deleted file mode 100644 index c80a78785b3b..000000000000 --- a/services/net/aidl/networkstack/1/android/net/InitialConfigurationParcelable.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package android.net; -parcelable InitialConfigurationParcelable { - android.net.LinkAddress[] ipAddresses; - android.net.IpPrefix[] directlyConnectedRoutes; - String[] dnsServers; - String gateway; -} diff --git a/services/net/aidl/networkstack/1/android/net/PrivateDnsConfigParcel.aidl b/services/net/aidl/networkstack/1/android/net/PrivateDnsConfigParcel.aidl deleted file mode 100644 index 2de790bb7754..000000000000 --- a/services/net/aidl/networkstack/1/android/net/PrivateDnsConfigParcel.aidl +++ /dev/null @@ -1,5 +0,0 @@ -package android.net; -parcelable PrivateDnsConfigParcel { - String hostname; - String[] ips; -} diff --git a/services/net/aidl/networkstack/1/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/aidl/networkstack/1/android/net/ProvisioningConfigurationParcelable.aidl deleted file mode 100644 index 3a6c30496fd8..000000000000 --- a/services/net/aidl/networkstack/1/android/net/ProvisioningConfigurationParcelable.aidl +++ /dev/null @@ -1,15 +0,0 @@ -package android.net; -parcelable ProvisioningConfigurationParcelable { - boolean enableIPv4; - boolean enableIPv6; - boolean usingMultinetworkPolicyTracker; - boolean usingIpReachabilityMonitor; - int requestedPreDhcpActionMs; - android.net.InitialConfigurationParcelable initialConfig; - android.net.StaticIpConfiguration staticIpConfig; - android.net.apf.ApfCapabilities apfCapabilities; - int provisioningTimeoutMs; - int ipv6AddrGenMode; - android.net.Network network; - String displayName; -} diff --git a/services/net/aidl/networkstack/1/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/1/android/net/TcpKeepalivePacketDataParcelable.aidl deleted file mode 100644 index e121c064f7ac..000000000000 --- a/services/net/aidl/networkstack/1/android/net/TcpKeepalivePacketDataParcelable.aidl +++ /dev/null @@ -1,13 +0,0 @@ -package android.net; -parcelable TcpKeepalivePacketDataParcelable { - byte[] srcAddress; - int srcPort; - byte[] dstAddress; - int dstPort; - int seq; - int ack; - int rcvWnd; - int rcvWndScale; - int tos; - int ttl; -} diff --git a/services/net/aidl/networkstack/1/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/aidl/networkstack/1/android/net/dhcp/DhcpServingParamsParcel.aidl deleted file mode 100644 index 67193ae904bc..000000000000 --- a/services/net/aidl/networkstack/1/android/net/dhcp/DhcpServingParamsParcel.aidl +++ /dev/null @@ -1,11 +0,0 @@ -package android.net.dhcp; -parcelable DhcpServingParamsParcel { - int serverAddr; - int serverAddrPrefixLength; - int[] defaultRouters; - int[] dnsServers; - int[] excludedAddrs; - long dhcpLeaseTimeSecs; - int linkMtu; - boolean metered; -} diff --git a/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServer.aidl b/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServer.aidl deleted file mode 100644 index 914315855496..000000000000 --- a/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServer.aidl +++ /dev/null @@ -1,10 +0,0 @@ -package android.net.dhcp; -interface IDhcpServer { - oneway void start(in android.net.INetworkStackStatusCallback cb); - oneway void updateParams(in android.net.dhcp.DhcpServingParamsParcel params, in android.net.INetworkStackStatusCallback cb); - oneway void stop(in android.net.INetworkStackStatusCallback cb); - const int STATUS_UNKNOWN = 0; - const int STATUS_SUCCESS = 1; - const int STATUS_INVALID_ARGUMENT = 2; - const int STATUS_UNKNOWN_ERROR = 3; -} diff --git a/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServerCallbacks.aidl deleted file mode 100644 index dcc4489d52a6..000000000000 --- a/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServerCallbacks.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.dhcp; -interface IDhcpServerCallbacks { - oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server); -} diff --git a/services/net/aidl/networkstack/1/android/net/ip/IIpClient.aidl b/services/net/aidl/networkstack/1/android/net/ip/IIpClient.aidl deleted file mode 100644 index 95a15742a684..000000000000 --- a/services/net/aidl/networkstack/1/android/net/ip/IIpClient.aidl +++ /dev/null @@ -1,14 +0,0 @@ -package android.net.ip; -interface IIpClient { - oneway void completedPreDhcpAction(); - oneway void confirmConfiguration(); - oneway void readPacketFilterComplete(in byte[] data); - oneway void shutdown(); - oneway void startProvisioning(in android.net.ProvisioningConfigurationParcelable req); - oneway void stop(); - oneway void setTcpBufferSizes(in String tcpBufferSizes); - oneway void setHttpProxy(in android.net.ProxyInfo proxyInfo); - oneway void setMulticastFilter(boolean enabled); - oneway void addKeepalivePacketFilter(int slot, in android.net.TcpKeepalivePacketDataParcelable pkt); - oneway void removeKeepalivePacketFilter(int slot); -} diff --git a/services/net/aidl/networkstack/1/android/net/ip/IIpClientCallbacks.aidl b/services/net/aidl/networkstack/1/android/net/ip/IIpClientCallbacks.aidl deleted file mode 100644 index d6bc8089a0be..000000000000 --- a/services/net/aidl/networkstack/1/android/net/ip/IIpClientCallbacks.aidl +++ /dev/null @@ -1,16 +0,0 @@ -package android.net.ip; -interface IIpClientCallbacks { - oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient); - oneway void onPreDhcpAction(); - oneway void onPostDhcpAction(); - oneway void onNewDhcpResults(in android.net.DhcpResultsParcelable dhcpResults); - oneway void onProvisioningSuccess(in android.net.LinkProperties newLp); - oneway void onProvisioningFailure(in android.net.LinkProperties newLp); - oneway void onLinkPropertiesChange(in android.net.LinkProperties newLp); - oneway void onReachabilityLost(in String logMsg); - oneway void onQuit(); - oneway void installPacketFilter(in byte[] filter); - oneway void startReadPacketFilter(); - oneway void setFallbackMulticastFilter(boolean enabled); - oneway void setNeighborDiscoveryOffload(boolean enable); -} diff --git a/services/net/aidl/networkstack/2/android/net/DhcpResultsParcelable.aidl b/services/net/aidl/networkstack/2/android/net/DhcpResultsParcelable.aidl deleted file mode 100644 index 31891de7230a..000000000000 --- a/services/net/aidl/networkstack/2/android/net/DhcpResultsParcelable.aidl +++ /dev/null @@ -1,9 +0,0 @@ -package android.net; -parcelable DhcpResultsParcelable { - android.net.StaticIpConfiguration baseConfiguration; - int leaseDuration; - int mtu; - String serverAddress; - String vendorInfo; - String serverHostName; -} diff --git a/services/net/aidl/networkstack/2/android/net/INetworkMonitor.aidl b/services/net/aidl/networkstack/2/android/net/INetworkMonitor.aidl deleted file mode 100644 index 029968b6f324..000000000000 --- a/services/net/aidl/networkstack/2/android/net/INetworkMonitor.aidl +++ /dev/null @@ -1,24 +0,0 @@ -package android.net; -interface INetworkMonitor { - oneway void start(); - oneway void launchCaptivePortalApp(); - oneway void notifyCaptivePortalAppFinished(int response); - oneway void setAcceptPartialConnectivity(); - oneway void forceReevaluation(int uid); - oneway void notifyPrivateDnsChanged(in android.net.PrivateDnsConfigParcel config); - oneway void notifyDnsResponse(int returnCode); - oneway void notifyNetworkConnected(in android.net.LinkProperties lp, in android.net.NetworkCapabilities nc); - oneway void notifyNetworkDisconnected(); - oneway void notifyLinkPropertiesChanged(in android.net.LinkProperties lp); - oneway void notifyNetworkCapabilitiesChanged(in android.net.NetworkCapabilities nc); - const int NETWORK_TEST_RESULT_VALID = 0; - const int NETWORK_TEST_RESULT_INVALID = 1; - const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2; - const int NETWORK_VALIDATION_RESULT_VALID = 1; - const int NETWORK_VALIDATION_RESULT_PARTIAL = 2; - const int NETWORK_VALIDATION_PROBE_DNS = 4; - const int NETWORK_VALIDATION_PROBE_HTTP = 8; - const int NETWORK_VALIDATION_PROBE_HTTPS = 16; - const int NETWORK_VALIDATION_PROBE_FALLBACK = 32; - const int NETWORK_VALIDATION_PROBE_PRIVDNS = 64; -} diff --git a/services/net/aidl/networkstack/2/android/net/INetworkMonitorCallbacks.aidl b/services/net/aidl/networkstack/2/android/net/INetworkMonitorCallbacks.aidl deleted file mode 100644 index ee9871ddcd15..000000000000 --- a/services/net/aidl/networkstack/2/android/net/INetworkMonitorCallbacks.aidl +++ /dev/null @@ -1,8 +0,0 @@ -package android.net; -interface INetworkMonitorCallbacks { - oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor); - oneway void notifyNetworkTested(int testResult, @nullable String redirectUrl); - oneway void notifyPrivateDnsConfigResolved(in android.net.PrivateDnsConfigParcel config); - oneway void showProvisioningNotification(String action, String packageName); - oneway void hideProvisioningNotification(); -} diff --git a/services/net/aidl/networkstack/2/android/net/INetworkStackConnector.aidl b/services/net/aidl/networkstack/2/android/net/INetworkStackConnector.aidl deleted file mode 100644 index 7da11e476c0e..000000000000 --- a/services/net/aidl/networkstack/2/android/net/INetworkStackConnector.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package android.net; -interface INetworkStackConnector { - oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb); - oneway void makeNetworkMonitor(in android.net.Network network, String name, in android.net.INetworkMonitorCallbacks cb); - oneway void makeIpClient(in String ifName, in android.net.ip.IIpClientCallbacks callbacks); - oneway void fetchIpMemoryStore(in android.net.IIpMemoryStoreCallbacks cb); -} diff --git a/services/net/aidl/networkstack/2/android/net/INetworkStackStatusCallback.aidl b/services/net/aidl/networkstack/2/android/net/INetworkStackStatusCallback.aidl deleted file mode 100644 index f6ca6f7a78e2..000000000000 --- a/services/net/aidl/networkstack/2/android/net/INetworkStackStatusCallback.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net; -interface INetworkStackStatusCallback { - oneway void onStatusAvailable(int statusCode); -} diff --git a/services/net/aidl/networkstack/2/android/net/InitialConfigurationParcelable.aidl b/services/net/aidl/networkstack/2/android/net/InitialConfigurationParcelable.aidl deleted file mode 100644 index c80a78785b3b..000000000000 --- a/services/net/aidl/networkstack/2/android/net/InitialConfigurationParcelable.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package android.net; -parcelable InitialConfigurationParcelable { - android.net.LinkAddress[] ipAddresses; - android.net.IpPrefix[] directlyConnectedRoutes; - String[] dnsServers; - String gateway; -} diff --git a/services/net/aidl/networkstack/2/android/net/NattKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/2/android/net/NattKeepalivePacketDataParcelable.aidl deleted file mode 100644 index 65de8833e6c5..000000000000 --- a/services/net/aidl/networkstack/2/android/net/NattKeepalivePacketDataParcelable.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package android.net; -parcelable NattKeepalivePacketDataParcelable { - byte[] srcAddress; - int srcPort; - byte[] dstAddress; - int dstPort; -} diff --git a/services/net/aidl/networkstack/2/android/net/PrivateDnsConfigParcel.aidl b/services/net/aidl/networkstack/2/android/net/PrivateDnsConfigParcel.aidl deleted file mode 100644 index 2de790bb7754..000000000000 --- a/services/net/aidl/networkstack/2/android/net/PrivateDnsConfigParcel.aidl +++ /dev/null @@ -1,5 +0,0 @@ -package android.net; -parcelable PrivateDnsConfigParcel { - String hostname; - String[] ips; -} diff --git a/services/net/aidl/networkstack/2/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/aidl/networkstack/2/android/net/ProvisioningConfigurationParcelable.aidl deleted file mode 100644 index 3a6c30496fd8..000000000000 --- a/services/net/aidl/networkstack/2/android/net/ProvisioningConfigurationParcelable.aidl +++ /dev/null @@ -1,15 +0,0 @@ -package android.net; -parcelable ProvisioningConfigurationParcelable { - boolean enableIPv4; - boolean enableIPv6; - boolean usingMultinetworkPolicyTracker; - boolean usingIpReachabilityMonitor; - int requestedPreDhcpActionMs; - android.net.InitialConfigurationParcelable initialConfig; - android.net.StaticIpConfiguration staticIpConfig; - android.net.apf.ApfCapabilities apfCapabilities; - int provisioningTimeoutMs; - int ipv6AddrGenMode; - android.net.Network network; - String displayName; -} diff --git a/services/net/aidl/networkstack/2/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/2/android/net/TcpKeepalivePacketDataParcelable.aidl deleted file mode 100644 index e121c064f7ac..000000000000 --- a/services/net/aidl/networkstack/2/android/net/TcpKeepalivePacketDataParcelable.aidl +++ /dev/null @@ -1,13 +0,0 @@ -package android.net; -parcelable TcpKeepalivePacketDataParcelable { - byte[] srcAddress; - int srcPort; - byte[] dstAddress; - int dstPort; - int seq; - int ack; - int rcvWnd; - int rcvWndScale; - int tos; - int ttl; -} diff --git a/services/net/aidl/networkstack/2/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/aidl/networkstack/2/android/net/dhcp/DhcpServingParamsParcel.aidl deleted file mode 100644 index 67193ae904bc..000000000000 --- a/services/net/aidl/networkstack/2/android/net/dhcp/DhcpServingParamsParcel.aidl +++ /dev/null @@ -1,11 +0,0 @@ -package android.net.dhcp; -parcelable DhcpServingParamsParcel { - int serverAddr; - int serverAddrPrefixLength; - int[] defaultRouters; - int[] dnsServers; - int[] excludedAddrs; - long dhcpLeaseTimeSecs; - int linkMtu; - boolean metered; -} diff --git a/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServer.aidl b/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServer.aidl deleted file mode 100644 index 914315855496..000000000000 --- a/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServer.aidl +++ /dev/null @@ -1,10 +0,0 @@ -package android.net.dhcp; -interface IDhcpServer { - oneway void start(in android.net.INetworkStackStatusCallback cb); - oneway void updateParams(in android.net.dhcp.DhcpServingParamsParcel params, in android.net.INetworkStackStatusCallback cb); - oneway void stop(in android.net.INetworkStackStatusCallback cb); - const int STATUS_UNKNOWN = 0; - const int STATUS_SUCCESS = 1; - const int STATUS_INVALID_ARGUMENT = 2; - const int STATUS_UNKNOWN_ERROR = 3; -} diff --git a/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServerCallbacks.aidl deleted file mode 100644 index dcc4489d52a6..000000000000 --- a/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServerCallbacks.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package android.net.dhcp; -interface IDhcpServerCallbacks { - oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server); -} diff --git a/services/net/aidl/networkstack/2/android/net/ip/IIpClient.aidl b/services/net/aidl/networkstack/2/android/net/ip/IIpClient.aidl deleted file mode 100644 index 77d5917de913..000000000000 --- a/services/net/aidl/networkstack/2/android/net/ip/IIpClient.aidl +++ /dev/null @@ -1,15 +0,0 @@ -package android.net.ip; -interface IIpClient { - oneway void completedPreDhcpAction(); - oneway void confirmConfiguration(); - oneway void readPacketFilterComplete(in byte[] data); - oneway void shutdown(); - oneway void startProvisioning(in android.net.ProvisioningConfigurationParcelable req); - oneway void stop(); - oneway void setTcpBufferSizes(in String tcpBufferSizes); - oneway void setHttpProxy(in android.net.ProxyInfo proxyInfo); - oneway void setMulticastFilter(boolean enabled); - oneway void addKeepalivePacketFilter(int slot, in android.net.TcpKeepalivePacketDataParcelable pkt); - oneway void removeKeepalivePacketFilter(int slot); - oneway void setL2KeyAndGroupHint(in String l2Key, in String groupHint); -} diff --git a/services/net/aidl/networkstack/2/android/net/ip/IIpClientCallbacks.aidl b/services/net/aidl/networkstack/2/android/net/ip/IIpClientCallbacks.aidl deleted file mode 100644 index d6bc8089a0be..000000000000 --- a/services/net/aidl/networkstack/2/android/net/ip/IIpClientCallbacks.aidl +++ /dev/null @@ -1,16 +0,0 @@ -package android.net.ip; -interface IIpClientCallbacks { - oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient); - oneway void onPreDhcpAction(); - oneway void onPostDhcpAction(); - oneway void onNewDhcpResults(in android.net.DhcpResultsParcelable dhcpResults); - oneway void onProvisioningSuccess(in android.net.LinkProperties newLp); - oneway void onProvisioningFailure(in android.net.LinkProperties newLp); - oneway void onLinkPropertiesChange(in android.net.LinkProperties newLp); - oneway void onReachabilityLost(in String logMsg); - oneway void onQuit(); - oneway void installPacketFilter(in byte[] filter); - oneway void startReadPacketFilter(); - oneway void setFallbackMulticastFilter(boolean enabled); - oneway void setNeighborDiscoveryOffload(boolean enable); -} diff --git a/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl b/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl deleted file mode 100644 index 07ff32111bb1..000000000000 --- a/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable DhcpResultsParcelable { - android.net.StaticIpConfiguration baseConfiguration; - int leaseDuration; - int mtu; - String serverAddress; - String vendorInfo; - String serverHostName; -} diff --git a/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl b/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl deleted file mode 100644 index 8aa68bd1c7bf..000000000000 --- a/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -interface INetworkMonitor { - oneway void start(); - oneway void launchCaptivePortalApp(); - oneway void notifyCaptivePortalAppFinished(int response); - oneway void setAcceptPartialConnectivity(); - oneway void forceReevaluation(int uid); - oneway void notifyPrivateDnsChanged(in android.net.PrivateDnsConfigParcel config); - oneway void notifyDnsResponse(int returnCode); - oneway void notifyNetworkConnected(in android.net.LinkProperties lp, in android.net.NetworkCapabilities nc); - oneway void notifyNetworkDisconnected(); - oneway void notifyLinkPropertiesChanged(in android.net.LinkProperties lp); - oneway void notifyNetworkCapabilitiesChanged(in android.net.NetworkCapabilities nc); - const int NETWORK_TEST_RESULT_VALID = 0; - const int NETWORK_TEST_RESULT_INVALID = 1; - const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2; - const int NETWORK_VALIDATION_RESULT_VALID = 1; - const int NETWORK_VALIDATION_RESULT_PARTIAL = 2; - const int NETWORK_VALIDATION_PROBE_DNS = 4; - const int NETWORK_VALIDATION_PROBE_HTTP = 8; - const int NETWORK_VALIDATION_PROBE_HTTPS = 16; - const int NETWORK_VALIDATION_PROBE_FALLBACK = 32; - const int NETWORK_VALIDATION_PROBE_PRIVDNS = 64; -} diff --git a/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl deleted file mode 100644 index ea93729da5e7..000000000000 --- a/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -interface INetworkMonitorCallbacks { - oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor); - oneway void notifyNetworkTested(int testResult, @nullable String redirectUrl); - oneway void notifyPrivateDnsConfigResolved(in android.net.PrivateDnsConfigParcel config); - oneway void showProvisioningNotification(String action, String packageName); - oneway void hideProvisioningNotification(); -} diff --git a/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl b/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl deleted file mode 100644 index e3a83d17eb0b..000000000000 --- a/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -interface INetworkStackConnector { - oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb); - oneway void makeNetworkMonitor(in android.net.Network network, String name, in android.net.INetworkMonitorCallbacks cb); - oneway void makeIpClient(in String ifName, in android.net.ip.IIpClientCallbacks callbacks); - oneway void fetchIpMemoryStore(in android.net.IIpMemoryStoreCallbacks cb); -} diff --git a/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl b/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl deleted file mode 100644 index 3112a081735a..000000000000 --- a/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -interface INetworkStackStatusCallback { - oneway void onStatusAvailable(int statusCode); -} diff --git a/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl b/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl deleted file mode 100644 index f846b26af808..000000000000 --- a/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable InitialConfigurationParcelable { - android.net.LinkAddress[] ipAddresses; - android.net.IpPrefix[] directlyConnectedRoutes; - String[] dnsServers; - String gateway; -} diff --git a/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl deleted file mode 100644 index de75940f5a50..000000000000 --- a/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable NattKeepalivePacketDataParcelable { - byte[] srcAddress; - int srcPort; - byte[] dstAddress; - int dstPort; -} diff --git a/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl b/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl deleted file mode 100644 index cf0fbce94c91..000000000000 --- a/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl +++ /dev/null @@ -1,22 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable PrivateDnsConfigParcel { - String hostname; - String[] ips; -} diff --git a/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl deleted file mode 100644 index c0f2d4d1747e..000000000000 --- a/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable ProvisioningConfigurationParcelable { - boolean enableIPv4; - boolean enableIPv6; - boolean usingMultinetworkPolicyTracker; - boolean usingIpReachabilityMonitor; - int requestedPreDhcpActionMs; - android.net.InitialConfigurationParcelable initialConfig; - android.net.StaticIpConfiguration staticIpConfig; - android.net.apf.ApfCapabilities apfCapabilities; - int provisioningTimeoutMs; - int ipv6AddrGenMode; - android.net.Network network; - String displayName; -} diff --git a/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl deleted file mode 100644 index 5926794c2e8a..000000000000 --- a/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl +++ /dev/null @@ -1,30 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net; -parcelable TcpKeepalivePacketDataParcelable { - byte[] srcAddress; - int srcPort; - byte[] dstAddress; - int dstPort; - int seq; - int ack; - int rcvWnd; - int rcvWndScale; - int tos; - int ttl; -} diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl deleted file mode 100644 index 7ab156f10553..000000000000 --- a/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl +++ /dev/null @@ -1,28 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.dhcp; -parcelable DhcpServingParamsParcel { - int serverAddr; - int serverAddrPrefixLength; - int[] defaultRouters; - int[] dnsServers; - int[] excludedAddrs; - long dhcpLeaseTimeSecs; - int linkMtu; - boolean metered; -} diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl deleted file mode 100644 index d281ecfee61d..000000000000 --- a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.dhcp; -interface IDhcpServer { - oneway void start(in android.net.INetworkStackStatusCallback cb); - oneway void updateParams(in android.net.dhcp.DhcpServingParamsParcel params, in android.net.INetworkStackStatusCallback cb); - oneway void stop(in android.net.INetworkStackStatusCallback cb); - const int STATUS_UNKNOWN = 0; - const int STATUS_SUCCESS = 1; - const int STATUS_INVALID_ARGUMENT = 2; - const int STATUS_UNKNOWN_ERROR = 3; -} diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl deleted file mode 100644 index 98be0ab1d540..000000000000 --- a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.dhcp; -interface IDhcpServerCallbacks { - oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server); -} diff --git a/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl b/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl deleted file mode 100644 index 85c8676ab8d0..000000000000 --- a/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl +++ /dev/null @@ -1,33 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ip; -interface IIpClient { - oneway void completedPreDhcpAction(); - oneway void confirmConfiguration(); - oneway void readPacketFilterComplete(in byte[] data); - oneway void shutdown(); - oneway void startProvisioning(in android.net.ProvisioningConfigurationParcelable req); - oneway void stop(); - oneway void setTcpBufferSizes(in String tcpBufferSizes); - oneway void setHttpProxy(in android.net.ProxyInfo proxyInfo); - oneway void setMulticastFilter(boolean enabled); - oneway void addKeepalivePacketFilter(int slot, in android.net.TcpKeepalivePacketDataParcelable pkt); - oneway void removeKeepalivePacketFilter(int slot); - oneway void setL2KeyAndGroupHint(in String l2Key, in String groupHint); - oneway void addNattKeepalivePacketFilter(int slot, in android.net.NattKeepalivePacketDataParcelable pkt); -} diff --git a/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl deleted file mode 100644 index 7fe39ed1ed7a..000000000000 --- a/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl +++ /dev/null @@ -1,33 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not -// try to edit this file. It looks like you are doing that because you have -// modified an AIDL interface in a backward-incompatible way, e.g., deleting a -// function from an interface or a field from a parcelable and it broke the -// build. That breakage is intended. -// -// You must not make a backward incompatible changes to the AIDL files built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.net.ip; -interface IIpClientCallbacks { - oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient); - oneway void onPreDhcpAction(); - oneway void onPostDhcpAction(); - oneway void onNewDhcpResults(in android.net.DhcpResultsParcelable dhcpResults); - oneway void onProvisioningSuccess(in android.net.LinkProperties newLp); - oneway void onProvisioningFailure(in android.net.LinkProperties newLp); - oneway void onLinkPropertiesChange(in android.net.LinkProperties newLp); - oneway void onReachabilityLost(in String logMsg); - oneway void onQuit(); - oneway void installPacketFilter(in byte[] filter); - oneway void startReadPacketFilter(); - oneway void setFallbackMulticastFilter(boolean enabled); - oneway void setNeighborDiscoveryOffload(boolean enable); -} diff --git a/services/net/java/android/net/DhcpResultsParcelable.aidl b/services/net/java/android/net/DhcpResultsParcelable.aidl deleted file mode 100644 index c98d9c201342..000000000000 --- a/services/net/java/android/net/DhcpResultsParcelable.aidl +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 perNmissions and - * limitations under the License. - */ - -package android.net; - -import android.net.StaticIpConfiguration; - -parcelable DhcpResultsParcelable { - StaticIpConfiguration baseConfiguration; - int leaseDuration; - int mtu; - String serverAddress; - String vendorInfo; - String serverHostName; -} diff --git a/services/net/java/android/net/IIpMemoryStore.aidl b/services/net/java/android/net/IIpMemoryStore.aidl deleted file mode 100644 index add221ae2e01..000000000000 --- a/services/net/java/android/net/IIpMemoryStore.aidl +++ /dev/null @@ -1,118 +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.net; - -import android.net.ipmemorystore.Blob; -import android.net.ipmemorystore.NetworkAttributesParcelable; -import android.net.ipmemorystore.IOnBlobRetrievedListener; -import android.net.ipmemorystore.IOnL2KeyResponseListener; -import android.net.ipmemorystore.IOnNetworkAttributesRetrievedListener; -import android.net.ipmemorystore.IOnSameL3NetworkResponseListener; -import android.net.ipmemorystore.IOnStatusListener; - -/** {@hide} */ -oneway interface IIpMemoryStore { - /** - * Store network attributes for a given L2 key. - * If L2Key is null, choose automatically from the attributes ; passing null is equivalent to - * calling findL2Key with the attributes and storing in the returned value. - * - * @param l2Key The L2 key for the L2 network. Clients that don't know or care about the L2 - * key and only care about grouping can pass a unique ID here like the ones - * generated by {@code java.util.UUID.randomUUID()}, but keep in mind the low - * relevance of such a network will lead to it being evicted soon if it's not - * refreshed. Use findL2Key to try and find a similar L2Key to these attributes. - * @param attributes The attributes for this network. - * @param listener A listener that will be invoked to inform of the completion of this call, - * or null if the client is not interested in learning about success/failure. - * @return (through the listener) The L2 key. This is useful if the L2 key was not specified. - * If the call failed, the L2 key will be null. - */ - void storeNetworkAttributes(String l2Key, in NetworkAttributesParcelable attributes, - IOnStatusListener listener); - - /** - * Store a binary blob associated with an L2 key and a name. - * - * @param l2Key The L2 key for this network. - * @param clientId The ID of the client. - * @param name The name of this data. - * @param data The data to store. - * @param listener A listener to inform of the completion of this call, or null if the client - * is not interested in learning about success/failure. - * @return (through the listener) A status to indicate success or failure. - */ - void storeBlob(String l2Key, String clientId, String name, in Blob data, - IOnStatusListener listener); - - /** - * Returns the best L2 key associated with the attributes. - * - * This will find a record that would be in the same group as the passed attributes. This is - * useful to choose the key for storing a sample or private data when the L2 key is not known. - * If multiple records are group-close to these attributes, the closest match is returned. - * If multiple records have the same closeness, the one with the smaller (unicode codepoint - * order) L2 key is returned. - * If no record matches these attributes, null is returned. - * - * @param attributes The attributes of the network to find. - * @param listener The listener that will be invoked to return the answer. - * @return (through the listener) The L2 key if one matched, or null. - */ - void findL2Key(in NetworkAttributesParcelable attributes, IOnL2KeyResponseListener listener); - - /** - * Returns whether, to the best of the store's ability to tell, the two specified L2 keys point - * to the same L3 network. Group-closeness is used to determine this. - * - * @param l2Key1 The key for the first network. - * @param l2Key2 The key for the second network. - * @param listener The listener that will be invoked to return the answer. - * @return (through the listener) A SameL3NetworkResponse containing the answer and confidence. - */ - void isSameNetwork(String l2Key1, String l2Key2, IOnSameL3NetworkResponseListener listener); - - /** - * Retrieve the network attributes for a key. - * If no record is present for this key, this will return null attributes. - * - * @param l2Key The key of the network to query. - * @param listener The listener that will be invoked to return the answer. - * @return (through the listener) The network attributes and the L2 key associated with - * the query. - */ - void retrieveNetworkAttributes(String l2Key, IOnNetworkAttributesRetrievedListener listener); - - /** - * Retrieve previously stored private data. - * If no data was stored for this L2 key and name this will return null. - * - * @param l2Key The L2 key. - * @param clientId The id of the client that stored this data. - * @param name The name of the data. - * @param listener The listener that will be invoked to return the answer. - * @return (through the listener) The private data (or null), with the L2 key - * and the name of the data associated with the query. - */ - void retrieveBlob(String l2Key, String clientId, String name, - IOnBlobRetrievedListener listener); - - /** - * Delete all data because a factory reset operation is in progress. - */ - void factoryReset(); -} diff --git a/services/net/java/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/java/android/net/IIpMemoryStoreCallbacks.aidl deleted file mode 100644 index 53108dbca097..000000000000 --- a/services/net/java/android/net/IIpMemoryStoreCallbacks.aidl +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.net; - -import android.net.IIpMemoryStore; - -/** {@hide} */ -oneway interface IIpMemoryStoreCallbacks { - void onIpMemoryStoreFetched(in IIpMemoryStore ipMemoryStore); -} diff --git a/services/net/java/android/net/INetworkMonitor.aidl b/services/net/java/android/net/INetworkMonitor.aidl deleted file mode 100644 index 3fc81a3dadc5..000000000000 --- a/services/net/java/android/net/INetworkMonitor.aidl +++ /dev/null @@ -1,68 +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 perNmissions and - * limitations under the License. - */ -package android.net; - -import android.net.LinkProperties; -import android.net.NetworkCapabilities; -import android.net.PrivateDnsConfigParcel; - -/** @hide */ -oneway interface INetworkMonitor { - // After a network has been tested this result can be sent with EVENT_NETWORK_TESTED. - // The network should be used as a default internet connection. It was found to be: - // 1. a functioning network providing internet access, or - // 2. a captive portal and the user decided to use it as is. - const int NETWORK_TEST_RESULT_VALID = 0; - - // After a network has been tested this result can be sent with EVENT_NETWORK_TESTED. - // The network should not be used as a default internet connection. It was found to be: - // 1. a captive portal and the user is prompted to sign-in, or - // 2. a captive portal and the user did not want to use it, or - // 3. a broken network (e.g. DNS failed, connect failed, HTTP request failed). - const int NETWORK_TEST_RESULT_INVALID = 1; - - // After a network has been tested, this result can be sent with EVENT_NETWORK_TESTED. - // The network may be used as a default internet connection, but it was found to be a partial - // connectivity network which can get the pass result for http probe but get the failed result - // for https probe. - const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2; - - // Network validation flags indicate probe result and types. If no NETWORK_VALIDATION_RESULT_* - // are set, then it's equal to NETWORK_TEST_RESULT_INVALID. If NETWORK_VALIDATION_RESULT_VALID - // is set, then the network validates and equal to NETWORK_TEST_RESULT_VALID. If - // NETWORK_VALIDATION_RESULT_PARTIAL is set, then the network has partial connectivity which - // is equal to NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY. NETWORK_VALIDATION_PROBE_* is set - // when the specific probe result of the network is resolved. - const int NETWORK_VALIDATION_RESULT_VALID = 0x01; - const int NETWORK_VALIDATION_RESULT_PARTIAL = 0x02; - const int NETWORK_VALIDATION_PROBE_DNS = 0x04; - const int NETWORK_VALIDATION_PROBE_HTTP = 0x08; - const int NETWORK_VALIDATION_PROBE_HTTPS = 0x10; - const int NETWORK_VALIDATION_PROBE_FALLBACK = 0x20; - const int NETWORK_VALIDATION_PROBE_PRIVDNS = 0x40; - - void start(); - void launchCaptivePortalApp(); - void notifyCaptivePortalAppFinished(int response); - void setAcceptPartialConnectivity(); - void forceReevaluation(int uid); - void notifyPrivateDnsChanged(in PrivateDnsConfigParcel config); - void notifyDnsResponse(int returnCode); - void notifyNetworkConnected(in LinkProperties lp, in NetworkCapabilities nc); - void notifyNetworkDisconnected(); - void notifyLinkPropertiesChanged(in LinkProperties lp); - void notifyNetworkCapabilitiesChanged(in NetworkCapabilities nc); -} diff --git a/services/net/java/android/net/INetworkMonitorCallbacks.aidl b/services/net/java/android/net/INetworkMonitorCallbacks.aidl deleted file mode 100644 index 2c61511feb72..000000000000 --- a/services/net/java/android/net/INetworkMonitorCallbacks.aidl +++ /dev/null @@ -1,29 +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.net; - -import android.net.INetworkMonitor; -import android.net.PrivateDnsConfigParcel; - -/** @hide */ -oneway interface INetworkMonitorCallbacks { - void onNetworkMonitorCreated(in INetworkMonitor networkMonitor); - void notifyNetworkTested(int testResult, @nullable String redirectUrl); - void notifyPrivateDnsConfigResolved(in PrivateDnsConfigParcel config); - void showProvisioningNotification(String action, String packageName); - void hideProvisioningNotification(); -}
\ No newline at end of file diff --git a/services/net/java/android/net/INetworkStackConnector.aidl b/services/net/java/android/net/INetworkStackConnector.aidl deleted file mode 100644 index 3751c36d6ee9..000000000000 --- a/services/net/java/android/net/INetworkStackConnector.aidl +++ /dev/null @@ -1,32 +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 perNmissions and - * limitations under the License. - */ -package android.net; - -import android.net.IIpMemoryStoreCallbacks; -import android.net.INetworkMonitorCallbacks; -import android.net.Network; -import android.net.dhcp.DhcpServingParamsParcel; -import android.net.dhcp.IDhcpServerCallbacks; -import android.net.ip.IIpClientCallbacks; - -/** @hide */ -oneway interface INetworkStackConnector { - void makeDhcpServer(in String ifName, in DhcpServingParamsParcel params, - in IDhcpServerCallbacks cb); - void makeNetworkMonitor(in Network network, String name, in INetworkMonitorCallbacks cb); - void makeIpClient(in String ifName, in IIpClientCallbacks callbacks); - void fetchIpMemoryStore(in IIpMemoryStoreCallbacks cb); -} diff --git a/services/net/java/android/net/INetworkStackStatusCallback.aidl b/services/net/java/android/net/INetworkStackStatusCallback.aidl deleted file mode 100644 index 51032d80a172..000000000000 --- a/services/net/java/android/net/INetworkStackStatusCallback.aidl +++ /dev/null @@ -1,22 +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.net; - -/** @hide */ -oneway interface INetworkStackStatusCallback { - void onStatusAvailable(int statusCode); -}
\ No newline at end of file diff --git a/services/net/java/android/net/InitialConfigurationParcelable.aidl b/services/net/java/android/net/InitialConfigurationParcelable.aidl deleted file mode 100644 index 3fa88c377a64..000000000000 --- a/services/net/java/android/net/InitialConfigurationParcelable.aidl +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.net; - -import android.net.IpPrefix; -import android.net.LinkAddress; - -parcelable InitialConfigurationParcelable { - LinkAddress[] ipAddresses; - IpPrefix[] directlyConnectedRoutes; - String[] dnsServers; - String gateway; -}
\ No newline at end of file diff --git a/services/net/java/android/net/IpMemoryStoreClient.java b/services/net/java/android/net/IpMemoryStoreClient.java deleted file mode 100644 index 014b5289bace..000000000000 --- a/services/net/java/android/net/IpMemoryStoreClient.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * 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.net; - -import android.annotation.NonNull; -import android.annotation.Nullable; -import android.content.Context; -import android.net.ipmemorystore.Blob; -import android.net.ipmemorystore.NetworkAttributes; -import android.net.ipmemorystore.OnBlobRetrievedListener; -import android.net.ipmemorystore.OnL2KeyResponseListener; -import android.net.ipmemorystore.OnNetworkAttributesRetrievedListener; -import android.net.ipmemorystore.OnSameL3NetworkResponseListener; -import android.net.ipmemorystore.OnStatusListener; -import android.net.ipmemorystore.Status; -import android.os.RemoteException; -import android.util.Log; - -import java.util.concurrent.ExecutionException; -import java.util.function.Consumer; - -/** - * service used to communicate with the ip memory store service in network stack, - * which is running in a separate module. - * @hide - */ -public abstract class IpMemoryStoreClient { - private static final String TAG = IpMemoryStoreClient.class.getSimpleName(); - private final Context mContext; - - public IpMemoryStoreClient(@NonNull final Context context) { - if (context == null) throw new IllegalArgumentException("missing context"); - mContext = context; - } - - protected abstract void runWhenServiceReady(Consumer<IIpMemoryStore> cb) - throws ExecutionException; - - @FunctionalInterface - private interface ThrowingRunnable { - void run() throws RemoteException; - } - - private void ignoringRemoteException(ThrowingRunnable r) { - ignoringRemoteException("Failed to execute remote procedure call", r); - } - - private void ignoringRemoteException(String message, ThrowingRunnable r) { - try { - r.run(); - } catch (RemoteException e) { - Log.e(TAG, message, e); - } - } - - /** - * Store network attributes for a given L2 key. - * If L2Key is null, choose automatically from the attributes ; passing null is equivalent to - * calling findL2Key with the attributes and storing in the returned value. - * - * @param l2Key The L2 key for the L2 network. Clients that don't know or care about the L2 - * key and only care about grouping can pass a unique ID here like the ones - * generated by {@code java.util.UUID.randomUUID()}, but keep in mind the low - * relevance of such a network will lead to it being evicted soon if it's not - * refreshed. Use findL2Key to try and find a similar L2Key to these attributes. - * @param attributes The attributes for this network. - * @param listener A listener that will be invoked to inform of the completion of this call, - * or null if the client is not interested in learning about success/failure. - * Through the listener, returns the L2 key. This is useful if the L2 key was not specified. - * If the call failed, the L2 key will be null. - */ - public void storeNetworkAttributes(@NonNull final String l2Key, - @NonNull final NetworkAttributes attributes, - @Nullable final OnStatusListener listener) { - try { - runWhenServiceReady(service -> ignoringRemoteException( - () -> service.storeNetworkAttributes(l2Key, attributes.toParcelable(), - OnStatusListener.toAIDL(listener)))); - } catch (ExecutionException m) { - ignoringRemoteException("Error storing network attributes", - () -> listener.onComplete(new Status(Status.ERROR_UNKNOWN))); - } - } - - /** - * Store a binary blob associated with an L2 key and a name. - * - * @param l2Key The L2 key for this network. - * @param clientId The ID of the client. - * @param name The name of this data. - * @param data The data to store. - * @param listener A listener to inform of the completion of this call, or null if the client - * is not interested in learning about success/failure. - * Through the listener, returns a status to indicate success or failure. - */ - public void storeBlob(@NonNull final String l2Key, @NonNull final String clientId, - @NonNull final String name, @NonNull final Blob data, - @Nullable final OnStatusListener listener) { - try { - runWhenServiceReady(service -> ignoringRemoteException( - () -> service.storeBlob(l2Key, clientId, name, data, - OnStatusListener.toAIDL(listener)))); - } catch (ExecutionException m) { - ignoringRemoteException("Error storing blob", - () -> listener.onComplete(new Status(Status.ERROR_UNKNOWN))); - } - } - - /** - * Returns the best L2 key associated with the attributes. - * - * This will find a record that would be in the same group as the passed attributes. This is - * useful to choose the key for storing a sample or private data when the L2 key is not known. - * If multiple records are group-close to these attributes, the closest match is returned. - * If multiple records have the same closeness, the one with the smaller (unicode codepoint - * order) L2 key is returned. - * If no record matches these attributes, null is returned. - * - * @param attributes The attributes of the network to find. - * @param listener The listener that will be invoked to return the answer. - * Through the listener, returns the L2 key if one matched, or null. - */ - public void findL2Key(@NonNull final NetworkAttributes attributes, - @NonNull final OnL2KeyResponseListener listener) { - try { - runWhenServiceReady(service -> ignoringRemoteException( - () -> service.findL2Key(attributes.toParcelable(), - OnL2KeyResponseListener.toAIDL(listener)))); - } catch (ExecutionException m) { - ignoringRemoteException("Error finding L2 Key", - () -> listener.onL2KeyResponse(new Status(Status.ERROR_UNKNOWN), null)); - } - } - - /** - * Returns whether, to the best of the store's ability to tell, the two specified L2 keys point - * to the same L3 network. Group-closeness is used to determine this. - * - * @param l2Key1 The key for the first network. - * @param l2Key2 The key for the second network. - * @param listener The listener that will be invoked to return the answer. - * Through the listener, a SameL3NetworkResponse containing the answer and confidence. - */ - public void isSameNetwork(@NonNull final String l2Key1, @NonNull final String l2Key2, - @NonNull final OnSameL3NetworkResponseListener listener) { - try { - runWhenServiceReady(service -> ignoringRemoteException( - () -> service.isSameNetwork(l2Key1, l2Key2, - OnSameL3NetworkResponseListener.toAIDL(listener)))); - } catch (ExecutionException m) { - ignoringRemoteException("Error checking for network sameness", - () -> listener.onSameL3NetworkResponse(new Status(Status.ERROR_UNKNOWN), null)); - } - } - - /** - * Retrieve the network attributes for a key. - * If no record is present for this key, this will return null attributes. - * - * @param l2Key The key of the network to query. - * @param listener The listener that will be invoked to return the answer. - * Through the listener, returns the network attributes and the L2 key associated with - * the query. - */ - public void retrieveNetworkAttributes(@NonNull final String l2Key, - @NonNull final OnNetworkAttributesRetrievedListener listener) { - try { - runWhenServiceReady(service -> ignoringRemoteException( - () -> service.retrieveNetworkAttributes(l2Key, - OnNetworkAttributesRetrievedListener.toAIDL(listener)))); - } catch (ExecutionException m) { - ignoringRemoteException("Error retrieving network attributes", - () -> listener.onNetworkAttributesRetrieved(new Status(Status.ERROR_UNKNOWN), - null, null)); - } - } - - /** - * Retrieve previously stored private data. - * If no data was stored for this L2 key and name this will return null. - * - * @param l2Key The L2 key. - * @param clientId The id of the client that stored this data. - * @param name The name of the data. - * @param listener The listener that will be invoked to return the answer. - * Through the listener, returns the private data (or null), with the L2 key - * and the name of the data associated with the query. - */ - public void retrieveBlob(@NonNull final String l2Key, @NonNull final String clientId, - @NonNull final String name, @NonNull final OnBlobRetrievedListener listener) { - try { - runWhenServiceReady(service -> ignoringRemoteException( - () -> service.retrieveBlob(l2Key, clientId, name, - OnBlobRetrievedListener.toAIDL(listener)))); - } catch (ExecutionException m) { - ignoringRemoteException("Error retrieving blob", - () -> listener.onBlobRetrieved(new Status(Status.ERROR_UNKNOWN), - null, null, null)); - } - } - - /** - * Wipe the data in the database upon network factory reset. - */ - public void factoryReset() { - try { - runWhenServiceReady(service -> ignoringRemoteException( - () -> service.factoryReset())); - } catch (ExecutionException m) { - Log.e(TAG, "Error executing factory reset", m); - } - } -} diff --git a/services/net/java/android/net/NattKeepalivePacketDataParcelable.aidl b/services/net/java/android/net/NattKeepalivePacketDataParcelable.aidl deleted file mode 100644 index 6f006d4971fb..000000000000 --- a/services/net/java/android/net/NattKeepalivePacketDataParcelable.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.net; - -parcelable NattKeepalivePacketDataParcelable { - byte[] srcAddress; - int srcPort; - byte[] dstAddress; - int dstPort; -} - diff --git a/services/net/java/android/net/PrivateDnsConfigParcel.aidl b/services/net/java/android/net/PrivateDnsConfigParcel.aidl deleted file mode 100644 index b52fce643302..000000000000 --- a/services/net/java/android/net/PrivateDnsConfigParcel.aidl +++ /dev/null @@ -1,22 +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.net; - -parcelable PrivateDnsConfigParcel { - String hostname; - String[] ips; -} diff --git a/services/net/java/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/java/android/net/ProvisioningConfigurationParcelable.aidl deleted file mode 100644 index 99606fb4b7a2..000000000000 --- a/services/net/java/android/net/ProvisioningConfigurationParcelable.aidl +++ /dev/null @@ -1,38 +0,0 @@ -/* -** -** 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.net; - -import android.net.InitialConfigurationParcelable; -import android.net.Network; -import android.net.StaticIpConfiguration; -import android.net.apf.ApfCapabilities; - -parcelable ProvisioningConfigurationParcelable { - boolean enableIPv4; - boolean enableIPv6; - boolean usingMultinetworkPolicyTracker; - boolean usingIpReachabilityMonitor; - int requestedPreDhcpActionMs; - InitialConfigurationParcelable initialConfig; - StaticIpConfiguration staticIpConfig; - ApfCapabilities apfCapabilities; - int provisioningTimeoutMs; - int ipv6AddrGenMode; - Network network; - String displayName; -} diff --git a/services/net/java/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/java/android/net/TcpKeepalivePacketDataParcelable.aidl deleted file mode 100644 index e25168d588e7..000000000000 --- a/services/net/java/android/net/TcpKeepalivePacketDataParcelable.aidl +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.net; - -parcelable TcpKeepalivePacketDataParcelable { - byte[] srcAddress; - int srcPort; - byte[] dstAddress; - int dstPort; - int seq; - int ack; - int rcvWnd; - int rcvWndScale; - int tos; - int ttl; -} diff --git a/services/net/java/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/java/android/net/dhcp/DhcpServingParamsParcel.aidl deleted file mode 100644 index 7b8b9ee324bc..000000000000 --- a/services/net/java/android/net/dhcp/DhcpServingParamsParcel.aidl +++ /dev/null @@ -1,30 +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.net.dhcp; - -parcelable DhcpServingParamsParcel { - int serverAddr; - int serverAddrPrefixLength; - int[] defaultRouters; - int[] dnsServers; - int[] excludedAddrs; - long dhcpLeaseTimeSecs; - int linkMtu; - boolean metered; -} - diff --git a/services/net/java/android/net/dhcp/IDhcpServer.aidl b/services/net/java/android/net/dhcp/IDhcpServer.aidl deleted file mode 100644 index 559433b13962..000000000000 --- a/services/net/java/android/net/dhcp/IDhcpServer.aidl +++ /dev/null @@ -1,32 +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 perNmissions and - * limitations under the License. - */ - -package android.net.dhcp; - -import android.net.INetworkStackStatusCallback; -import android.net.dhcp.DhcpServingParamsParcel; - -/** @hide */ -oneway interface IDhcpServer { - const int STATUS_UNKNOWN = 0; - const int STATUS_SUCCESS = 1; - const int STATUS_INVALID_ARGUMENT = 2; - const int STATUS_UNKNOWN_ERROR = 3; - - void start(in INetworkStackStatusCallback cb); - void updateParams(in DhcpServingParamsParcel params, in INetworkStackStatusCallback cb); - void stop(in INetworkStackStatusCallback cb); -} diff --git a/services/net/java/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/java/android/net/dhcp/IDhcpServerCallbacks.aidl deleted file mode 100644 index 7ab4dcdbe584..000000000000 --- a/services/net/java/android/net/dhcp/IDhcpServerCallbacks.aidl +++ /dev/null @@ -1,24 +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 perNmissions and - * limitations under the License. - */ - -package android.net.dhcp; - -import android.net.dhcp.IDhcpServer; - -/** @hide */ -oneway interface IDhcpServerCallbacks { - void onDhcpServerCreated(int statusCode, in IDhcpServer server); -} diff --git a/services/net/java/android/net/ip/IIpClient.aidl b/services/net/java/android/net/ip/IIpClient.aidl deleted file mode 100644 index 9989c52fc403..000000000000 --- a/services/net/java/android/net/ip/IIpClient.aidl +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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 perNmissions and - * limitations under the License. - */ -package android.net.ip; - -import android.net.ProxyInfo; -import android.net.ProvisioningConfigurationParcelable; -import android.net.NattKeepalivePacketDataParcelable; -import android.net.TcpKeepalivePacketDataParcelable; - -/** @hide */ -oneway interface IIpClient { - void completedPreDhcpAction(); - void confirmConfiguration(); - void readPacketFilterComplete(in byte[] data); - void shutdown(); - void startProvisioning(in ProvisioningConfigurationParcelable req); - void stop(); - void setTcpBufferSizes(in String tcpBufferSizes); - void setHttpProxy(in ProxyInfo proxyInfo); - void setMulticastFilter(boolean enabled); - void addKeepalivePacketFilter(int slot, in TcpKeepalivePacketDataParcelable pkt); - void removeKeepalivePacketFilter(int slot); - void setL2KeyAndGroupHint(in String l2Key, in String groupHint); - void addNattKeepalivePacketFilter(int slot, in NattKeepalivePacketDataParcelable pkt); -} diff --git a/services/net/java/android/net/ip/IIpClientCallbacks.aidl b/services/net/java/android/net/ip/IIpClientCallbacks.aidl deleted file mode 100644 index 3681416611a9..000000000000 --- a/services/net/java/android/net/ip/IIpClientCallbacks.aidl +++ /dev/null @@ -1,66 +0,0 @@ -/** - * 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 perNmissions and - * limitations under the License. - */ -package android.net.ip; - -import android.net.LinkProperties; -import android.net.ip.IIpClient; -import android.net.DhcpResultsParcelable; - -/** @hide */ -oneway interface IIpClientCallbacks { - void onIpClientCreated(in IIpClient ipClient); - - void onPreDhcpAction(); - void onPostDhcpAction(); - - // This is purely advisory and not an indication of provisioning - // success or failure. This is only here for callers that want to - // expose DHCPv4 results to other APIs (e.g., WifiInfo#setInetAddress). - // DHCPv4 or static IPv4 configuration failure or success can be - // determined by whether or not the passed-in DhcpResults object is - // null or not. - void onNewDhcpResults(in DhcpResultsParcelable dhcpResults); - - void onProvisioningSuccess(in LinkProperties newLp); - void onProvisioningFailure(in LinkProperties newLp); - - // Invoked on LinkProperties changes. - void onLinkPropertiesChange(in LinkProperties newLp); - - // Called when the internal IpReachabilityMonitor (if enabled) has - // detected the loss of a critical number of required neighbors. - void onReachabilityLost(in String logMsg); - - // Called when the IpClient state machine terminates. - void onQuit(); - - // Install an APF program to filter incoming packets. - void installPacketFilter(in byte[] filter); - - // Asynchronously read back the APF program & data buffer from the wifi driver. - // Due to Wifi HAL limitations, the current implementation only supports dumping the entire - // buffer. In response to this request, the driver returns the data buffer asynchronously - // by sending an IpClient#EVENT_READ_PACKET_FILTER_COMPLETE message. - void startReadPacketFilter(); - - // If multicast filtering cannot be accomplished with APF, this function will be called to - // actuate multicast filtering using another means. - void setFallbackMulticastFilter(boolean enabled); - - // Enabled/disable Neighbor Discover offload functionality. This is - // called, for example, whenever 464xlat is being started or stopped. - void setNeighborDiscoveryOffload(boolean enable); -}
\ No newline at end of file diff --git a/services/net/java/android/net/ipmemorystore/Blob.aidl b/services/net/java/android/net/ipmemorystore/Blob.aidl deleted file mode 100644 index 9dbef117f8a4..000000000000 --- a/services/net/java/android/net/ipmemorystore/Blob.aidl +++ /dev/null @@ -1,26 +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.net.ipmemorystore; - -/** - * A blob of data opaque to the memory store. The client mutates this at its own risk, - * and it is strongly suggested to never do it at all and treat this as immutable. - * {@hide} - */ -parcelable Blob { - byte[] data; -} diff --git a/services/net/java/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/java/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl deleted file mode 100644 index 4926feb06e55..000000000000 --- a/services/net/java/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl +++ /dev/null @@ -1,30 +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.net.ipmemorystore; - -import android.net.ipmemorystore.Blob; -import android.net.ipmemorystore.StatusParcelable; - -/** {@hide} */ -oneway interface IOnBlobRetrievedListener { - /** - * Private data was retrieved for the L2 key and name specified. - * Note this does not return the client ID, as clients are expected to only ever use one ID. - */ - void onBlobRetrieved(in StatusParcelable status, in String l2Key, in String name, - in Blob data); -} diff --git a/services/net/java/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/java/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl deleted file mode 100644 index dea0cc4e2586..000000000000 --- a/services/net/java/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl +++ /dev/null @@ -1,27 +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.net.ipmemorystore; - -import android.net.ipmemorystore.StatusParcelable; - -/** {@hide} */ -oneway interface IOnL2KeyResponseListener { - /** - * The operation completed with the specified L2 key. - */ - void onL2KeyResponse(in StatusParcelable status, in String l2Key); -} diff --git a/services/net/java/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/java/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl deleted file mode 100644 index 870e217eb5b7..000000000000 --- a/services/net/java/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl +++ /dev/null @@ -1,30 +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.net.ipmemorystore; - -import android.net.ipmemorystore.NetworkAttributesParcelable; -import android.net.ipmemorystore.StatusParcelable; - -/** {@hide} */ -oneway interface IOnNetworkAttributesRetrievedListener { - /** - * Network attributes were fetched for the specified L2 key. While the L2 key will never - * be null, the attributes may be if no data is stored about this L2 key. - */ - void onNetworkAttributesRetrieved(in StatusParcelable status, in String l2Key, - in NetworkAttributesParcelable attributes); -} diff --git a/services/net/java/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/java/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl deleted file mode 100644 index b8ccfb99fddd..000000000000 --- a/services/net/java/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl +++ /dev/null @@ -1,29 +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.net.ipmemorystore; - -import android.net.ipmemorystore.SameL3NetworkResponseParcelable; -import android.net.ipmemorystore.StatusParcelable; - -/** {@hide} */ -oneway interface IOnSameL3NetworkResponseListener { - /** - * The memory store has come up with the answer to a query that was sent. - */ - void onSameL3NetworkResponse(in StatusParcelable status, - in SameL3NetworkResponseParcelable response); -} diff --git a/services/net/java/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/java/android/net/ipmemorystore/IOnStatusListener.aidl deleted file mode 100644 index 5d0750449ec5..000000000000 --- a/services/net/java/android/net/ipmemorystore/IOnStatusListener.aidl +++ /dev/null @@ -1,27 +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.net.ipmemorystore; - -import android.net.ipmemorystore.StatusParcelable; - -/** {@hide} */ -oneway interface IOnStatusListener { - /** - * The operation has completed with the specified status. - */ - void onComplete(in StatusParcelable status); -} diff --git a/services/net/java/android/net/ipmemorystore/NetworkAttributes.java b/services/net/java/android/net/ipmemorystore/NetworkAttributes.java deleted file mode 100644 index 818515ac9af1..000000000000 --- a/services/net/java/android/net/ipmemorystore/NetworkAttributes.java +++ /dev/null @@ -1,371 +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.net.ipmemorystore; - -import android.annotation.NonNull; -import android.annotation.Nullable; - -import com.android.internal.annotations.VisibleForTesting; - -import java.net.Inet4Address; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.StringJoiner; - -/** - * A POD object to represent attributes of a single L2 network entry. - * @hide - */ -public class NetworkAttributes { - private static final boolean DBG = true; - - // Weight cutoff for grouping. To group, a similarity score is computed with the following - // algorithm : if both fields are non-null and equals() then add their assigned weight, else if - // both are null then add a portion of their assigned weight (see NULL_MATCH_WEIGHT), - // otherwise add nothing. - // As a guideline, this should be something like 60~75% of the total weights in this class. The - // design states "in essence a reader should imagine that if two important columns don't match, - // or one important and several unimportant columns don't match then the two records are - // considered a different group". - private static final float TOTAL_WEIGHT_CUTOFF = 520.0f; - // The portion of the weight that is earned when scoring group-sameness by having both columns - // being null. This is because some networks rightfully don't have some attributes (e.g. a - // V6-only network won't have an assigned V4 address) and both being null should count for - // something, but attributes may also be null just because data is unavailable. - private static final float NULL_MATCH_WEIGHT = 0.25f; - - // The v4 address that was assigned to this device the last time it joined this network. - // This typically comes from DHCP but could be something else like static configuration. - // This does not apply to IPv6. - // TODO : add a list of v6 prefixes for the v6 case. - @Nullable - public final Inet4Address assignedV4Address; - private static final float WEIGHT_ASSIGNEDV4ADDR = 300.0f; - - // The lease expiry timestamp of v4 address allocated from DHCP server, in milliseconds. - @Nullable - public final Long assignedV4AddressExpiry; - // lease expiry doesn't imply any correlation between "the same lease expiry value" and "the - // same L3 network". - private static final float WEIGHT_ASSIGNEDV4ADDREXPIRY = 0.0f; - - // Optionally supplied by the client if it has an opinion on L3 network. For example, this - // could be a hash of the SSID + security type on WiFi. - @Nullable - public final String groupHint; - private static final float WEIGHT_GROUPHINT = 300.0f; - - // The list of DNS server addresses. - @Nullable - public final List<InetAddress> dnsAddresses; - private static final float WEIGHT_DNSADDRESSES = 200.0f; - - // The mtu on this network. - @Nullable - public final Integer mtu; - private static final float WEIGHT_MTU = 50.0f; - - // The sum of all weights in this class. Tests ensure that this stays equal to the total of - // all weights. - /** @hide */ - @VisibleForTesting - public static final float TOTAL_WEIGHT = WEIGHT_ASSIGNEDV4ADDR - + WEIGHT_ASSIGNEDV4ADDREXPIRY - + WEIGHT_GROUPHINT - + WEIGHT_DNSADDRESSES - + WEIGHT_MTU; - - /** @hide */ - @VisibleForTesting - public NetworkAttributes( - @Nullable final Inet4Address assignedV4Address, - @Nullable final Long assignedV4AddressExpiry, - @Nullable final String groupHint, - @Nullable final List<InetAddress> dnsAddresses, - @Nullable final Integer mtu) { - if (mtu != null && mtu < 0) throw new IllegalArgumentException("MTU can't be negative"); - if (assignedV4AddressExpiry != null && assignedV4AddressExpiry <= 0) { - throw new IllegalArgumentException("lease expiry can't be negative or zero"); - } - this.assignedV4Address = assignedV4Address; - this.assignedV4AddressExpiry = assignedV4AddressExpiry; - this.groupHint = groupHint; - this.dnsAddresses = null == dnsAddresses ? null : - Collections.unmodifiableList(new ArrayList<>(dnsAddresses)); - this.mtu = mtu; - } - - @VisibleForTesting - public NetworkAttributes(@NonNull final NetworkAttributesParcelable parcelable) { - // The call to the other constructor must be the first statement of this constructor, - // so everything has to be inline - this((Inet4Address) getByAddressOrNull(parcelable.assignedV4Address), - parcelable.assignedV4AddressExpiry > 0 - ? parcelable.assignedV4AddressExpiry : null, - parcelable.groupHint, - blobArrayToInetAddressList(parcelable.dnsAddresses), - parcelable.mtu >= 0 ? parcelable.mtu : null); - } - - @Nullable - private static InetAddress getByAddressOrNull(@Nullable final byte[] address) { - if (null == address) return null; - try { - return InetAddress.getByAddress(address); - } catch (UnknownHostException e) { - return null; - } - } - - @Nullable - private static List<InetAddress> blobArrayToInetAddressList(@Nullable final Blob[] blobs) { - if (null == blobs) return null; - final ArrayList<InetAddress> list = new ArrayList<>(blobs.length); - for (final Blob b : blobs) { - final InetAddress addr = getByAddressOrNull(b.data); - if (null != addr) list.add(addr); - } - return list; - } - - @Nullable - private static Blob[] inetAddressListToBlobArray(@Nullable final List<InetAddress> addresses) { - if (null == addresses) return null; - final ArrayList<Blob> blobs = new ArrayList<>(); - for (int i = 0; i < addresses.size(); ++i) { - final InetAddress addr = addresses.get(i); - if (null == addr) continue; - final Blob b = new Blob(); - b.data = addr.getAddress(); - blobs.add(b); - } - return blobs.toArray(new Blob[0]); - } - - /** Converts this NetworkAttributes to a parcelable object */ - @NonNull - public NetworkAttributesParcelable toParcelable() { - final NetworkAttributesParcelable parcelable = new NetworkAttributesParcelable(); - parcelable.assignedV4Address = - (null == assignedV4Address) ? null : assignedV4Address.getAddress(); - parcelable.assignedV4AddressExpiry = - (null == assignedV4AddressExpiry) ? 0 : assignedV4AddressExpiry; - parcelable.groupHint = groupHint; - parcelable.dnsAddresses = inetAddressListToBlobArray(dnsAddresses); - parcelable.mtu = (null == mtu) ? -1 : mtu; - return parcelable; - } - - private float samenessContribution(final float weight, - @Nullable final Object o1, @Nullable final Object o2) { - if (null == o1) { - return (null == o2) ? weight * NULL_MATCH_WEIGHT : 0f; - } - return Objects.equals(o1, o2) ? weight : 0f; - } - - /** @hide */ - public float getNetworkGroupSamenessConfidence(@NonNull final NetworkAttributes o) { - final float samenessScore = - samenessContribution(WEIGHT_ASSIGNEDV4ADDR, assignedV4Address, o.assignedV4Address) - + samenessContribution(WEIGHT_ASSIGNEDV4ADDREXPIRY, assignedV4AddressExpiry, - o.assignedV4AddressExpiry) - + samenessContribution(WEIGHT_GROUPHINT, groupHint, o.groupHint) - + samenessContribution(WEIGHT_DNSADDRESSES, dnsAddresses, o.dnsAddresses) - + samenessContribution(WEIGHT_MTU, mtu, o.mtu); - // The minimum is 0, the max is TOTAL_WEIGHT and should be represented by 1.0, and - // TOTAL_WEIGHT_CUTOFF should represent 0.5, but there is no requirement that - // TOTAL_WEIGHT_CUTOFF would be half of TOTAL_WEIGHT (indeed, it should not be). - // So scale scores under the cutoff between 0 and 0.5, and the scores over the cutoff - // between 0.5 and 1.0. - if (samenessScore < TOTAL_WEIGHT_CUTOFF) { - return samenessScore / (TOTAL_WEIGHT_CUTOFF * 2); - } else { - return (samenessScore - TOTAL_WEIGHT_CUTOFF) / (TOTAL_WEIGHT - TOTAL_WEIGHT_CUTOFF) / 2 - + 0.5f; - } - } - - /** @hide */ - public static class Builder { - @Nullable - private Inet4Address mAssignedAddress; - @Nullable - private Long mAssignedAddressExpiry; - @Nullable - private String mGroupHint; - @Nullable - private List<InetAddress> mDnsAddresses; - @Nullable - private Integer mMtu; - - /** - * Set the assigned address. - * @param assignedV4Address The assigned address. - * @return This builder. - */ - public Builder setAssignedV4Address(@Nullable final Inet4Address assignedV4Address) { - mAssignedAddress = assignedV4Address; - return this; - } - - /** - * Set the lease expiry timestamp of assigned v4 address. Long.MAX_VALUE is used - * to represent "infinite lease". - * - * @param assignedV4AddressExpiry The lease expiry timestamp of assigned v4 address. - * @return This builder. - */ - public Builder setAssignedV4AddressExpiry( - @Nullable final Long assignedV4AddressExpiry) { - if (null != assignedV4AddressExpiry && assignedV4AddressExpiry <= 0) { - throw new IllegalArgumentException("lease expiry can't be negative or zero"); - } - mAssignedAddressExpiry = assignedV4AddressExpiry; - return this; - } - - /** - * Set the group hint. - * @param groupHint The group hint. - * @return This builder. - */ - public Builder setGroupHint(@Nullable final String groupHint) { - mGroupHint = groupHint; - return this; - } - - /** - * Set the DNS addresses. - * @param dnsAddresses The DNS addresses. - * @return This builder. - */ - public Builder setDnsAddresses(@Nullable final List<InetAddress> dnsAddresses) { - if (DBG && null != dnsAddresses) { - // Parceling code crashes if one of the addresses is null, therefore validate - // them when running in debug. - for (final InetAddress address : dnsAddresses) { - if (null == address) throw new IllegalArgumentException("Null DNS address"); - } - } - this.mDnsAddresses = dnsAddresses; - return this; - } - - /** - * Set the MTU. - * @param mtu The MTU. - * @return This builder. - */ - public Builder setMtu(@Nullable final Integer mtu) { - if (null != mtu && mtu < 0) throw new IllegalArgumentException("MTU can't be negative"); - mMtu = mtu; - return this; - } - - /** - * Return the built NetworkAttributes object. - * @return The built NetworkAttributes object. - */ - public NetworkAttributes build() { - return new NetworkAttributes(mAssignedAddress, mAssignedAddressExpiry, - mGroupHint, mDnsAddresses, mMtu); - } - } - - /** @hide */ - public boolean isEmpty() { - return (null == assignedV4Address) && (null == assignedV4AddressExpiry) - && (null == groupHint) && (null == dnsAddresses) && (null == mtu); - } - - @Override - public boolean equals(@Nullable final Object o) { - if (!(o instanceof NetworkAttributes)) return false; - final NetworkAttributes other = (NetworkAttributes) o; - return Objects.equals(assignedV4Address, other.assignedV4Address) - && Objects.equals(assignedV4AddressExpiry, other.assignedV4AddressExpiry) - && Objects.equals(groupHint, other.groupHint) - && Objects.equals(dnsAddresses, other.dnsAddresses) - && Objects.equals(mtu, other.mtu); - } - - @Override - public int hashCode() { - return Objects.hash(assignedV4Address, assignedV4AddressExpiry, - groupHint, dnsAddresses, mtu); - } - - /** Pretty print */ - @Override - public String toString() { - final StringJoiner resultJoiner = new StringJoiner(" ", "{", "}"); - final ArrayList<String> nullFields = new ArrayList<>(); - - if (null != assignedV4Address) { - resultJoiner.add("assignedV4Addr :"); - resultJoiner.add(assignedV4Address.toString()); - } else { - nullFields.add("assignedV4Addr"); - } - - if (null != assignedV4AddressExpiry) { - resultJoiner.add("assignedV4AddressExpiry :"); - resultJoiner.add(assignedV4AddressExpiry.toString()); - } else { - nullFields.add("assignedV4AddressExpiry"); - } - - if (null != groupHint) { - resultJoiner.add("groupHint :"); - resultJoiner.add(groupHint); - } else { - nullFields.add("groupHint"); - } - - if (null != dnsAddresses) { - resultJoiner.add("dnsAddr : ["); - for (final InetAddress addr : dnsAddresses) { - resultJoiner.add(addr.getHostAddress()); - } - resultJoiner.add("]"); - } else { - nullFields.add("dnsAddr"); - } - - if (null != mtu) { - resultJoiner.add("mtu :"); - resultJoiner.add(mtu.toString()); - } else { - nullFields.add("mtu"); - } - - if (!nullFields.isEmpty()) { - resultJoiner.add("; Null fields : ["); - for (final String field : nullFields) { - resultJoiner.add(field); - } - resultJoiner.add("]"); - } - - return resultJoiner.toString(); - } -} diff --git a/services/net/java/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/java/android/net/ipmemorystore/NetworkAttributesParcelable.aidl deleted file mode 100644 index 997eb2b5128b..000000000000 --- a/services/net/java/android/net/ipmemorystore/NetworkAttributesParcelable.aidl +++ /dev/null @@ -1,37 +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.net.ipmemorystore; - -// Blob[] is used to represent an array of byte[], as structured AIDL does not support arrays -// of arrays. -import android.net.ipmemorystore.Blob; - -/** - * An object to represent attributes of a single L2 network entry. - * See NetworkAttributes.java for a description of each field. The types used in this class - * are structured parcelable types instead of the richer types of the NetworkAttributes object, - * but they have the same purpose. The NetworkAttributes.java file also contains the code - * to convert the richer types to the parcelable types and back. - * @hide - */ -parcelable NetworkAttributesParcelable { - byte[] assignedV4Address; - long assignedV4AddressExpiry; - String groupHint; - Blob[] dnsAddresses; - int mtu; -} diff --git a/services/net/java/android/net/ipmemorystore/OnBlobRetrievedListener.java b/services/net/java/android/net/ipmemorystore/OnBlobRetrievedListener.java deleted file mode 100644 index a17483a84e78..000000000000 --- a/services/net/java/android/net/ipmemorystore/OnBlobRetrievedListener.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.net.ipmemorystore; - -import android.annotation.NonNull; - -/** - * A listener for the IpMemoryStore to return a blob. - * @hide - */ -public interface OnBlobRetrievedListener { - /** - * The memory store has come up with the answer to a query that was sent. - */ - void onBlobRetrieved(Status status, String l2Key, String name, Blob blob); - - /** Converts this OnBlobRetrievedListener to a parcelable object */ - @NonNull - static IOnBlobRetrievedListener toAIDL(@NonNull final OnBlobRetrievedListener listener) { - return new IOnBlobRetrievedListener.Stub() { - @Override - public void onBlobRetrieved(final StatusParcelable statusParcelable, final String l2Key, - final String name, final Blob blob) { - // NonNull, but still don't crash the system server if null - if (null != listener) { - listener.onBlobRetrieved(new Status(statusParcelable), l2Key, name, blob); - } - } - - @Override - public int getInterfaceVersion() { - return this.VERSION; - } - }; - } -} diff --git a/services/net/java/android/net/ipmemorystore/OnL2KeyResponseListener.java b/services/net/java/android/net/ipmemorystore/OnL2KeyResponseListener.java deleted file mode 100644 index e608aecbf498..000000000000 --- a/services/net/java/android/net/ipmemorystore/OnL2KeyResponseListener.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.net.ipmemorystore; - -import android.annotation.NonNull; - -/** - * A listener for the IpMemoryStore to return a L2 key. - * @hide - */ -public interface OnL2KeyResponseListener { - /** - * The operation has completed with the specified status. - */ - void onL2KeyResponse(Status status, String l2Key); - - /** Converts this OnL2KeyResponseListener to a parcelable object */ - @NonNull - static IOnL2KeyResponseListener toAIDL(@NonNull final OnL2KeyResponseListener listener) { - return new IOnL2KeyResponseListener.Stub() { - @Override - public void onL2KeyResponse(final StatusParcelable statusParcelable, - final String l2Key) { - // NonNull, but still don't crash the system server if null - if (null != listener) { - listener.onL2KeyResponse(new Status(statusParcelable), l2Key); - } - } - - @Override - public int getInterfaceVersion() { - return this.VERSION; - } - }; - } -} diff --git a/services/net/java/android/net/ipmemorystore/OnNetworkAttributesRetrievedListener.java b/services/net/java/android/net/ipmemorystore/OnNetworkAttributesRetrievedListener.java deleted file mode 100644 index 395ad98f38e0..000000000000 --- a/services/net/java/android/net/ipmemorystore/OnNetworkAttributesRetrievedListener.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.net.ipmemorystore; - -import android.annotation.NonNull; - -/** - * A listener for the IpMemoryStore to return network attributes. - * @hide - */ -public interface OnNetworkAttributesRetrievedListener { - /** - * The memory store has come up with the answer to a query that was sent. - */ - void onNetworkAttributesRetrieved(Status status, String l2Key, NetworkAttributes attributes); - - /** Converts this OnNetworkAttributesRetrievedListener to a parcelable object */ - @NonNull - static IOnNetworkAttributesRetrievedListener toAIDL( - @NonNull final OnNetworkAttributesRetrievedListener listener) { - return new IOnNetworkAttributesRetrievedListener.Stub() { - @Override - public void onNetworkAttributesRetrieved(final StatusParcelable statusParcelable, - final String l2Key, - final NetworkAttributesParcelable networkAttributesParcelable) { - // NonNull, but still don't crash the system server if null - if (null != listener) { - listener.onNetworkAttributesRetrieved( - new Status(statusParcelable), l2Key, null == networkAttributesParcelable - ? null : new NetworkAttributes(networkAttributesParcelable)); - } - } - - @Override - public int getInterfaceVersion() { - return this.VERSION; - } - }; - } -} diff --git a/services/net/java/android/net/ipmemorystore/OnSameL3NetworkResponseListener.java b/services/net/java/android/net/ipmemorystore/OnSameL3NetworkResponseListener.java deleted file mode 100644 index 67f8da81c3f2..000000000000 --- a/services/net/java/android/net/ipmemorystore/OnSameL3NetworkResponseListener.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.net.ipmemorystore; - -import android.annotation.NonNull; - -/** - * A listener for the IpMemoryStore to return a response about network sameness. - * @hide - */ -public interface OnSameL3NetworkResponseListener { - /** - * The memory store has come up with the answer to a query that was sent. - */ - void onSameL3NetworkResponse(Status status, SameL3NetworkResponse response); - - /** Converts this OnSameL3NetworkResponseListener to a parcelable object */ - @NonNull - static IOnSameL3NetworkResponseListener toAIDL( - @NonNull final OnSameL3NetworkResponseListener listener) { - return new IOnSameL3NetworkResponseListener.Stub() { - @Override - public void onSameL3NetworkResponse(final StatusParcelable statusParcelable, - final SameL3NetworkResponseParcelable sameL3NetworkResponseParcelable) { - // NonNull, but still don't crash the system server if null - if (null != listener) { - listener.onSameL3NetworkResponse( - new Status(statusParcelable), - new SameL3NetworkResponse(sameL3NetworkResponseParcelable)); - } - } - - @Override - public int getInterfaceVersion() { - return this.VERSION; - } - }; - } -} diff --git a/services/net/java/android/net/ipmemorystore/OnStatusListener.java b/services/net/java/android/net/ipmemorystore/OnStatusListener.java deleted file mode 100644 index 4262efde8843..000000000000 --- a/services/net/java/android/net/ipmemorystore/OnStatusListener.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.net.ipmemorystore; - -import android.annotation.NonNull; -import android.annotation.Nullable; - -/** - * A listener for the IpMemoryStore to return a status to a client. - * @hide - */ -public interface OnStatusListener { - /** - * The operation has completed with the specified status. - */ - void onComplete(Status status); - - /** Converts this OnStatusListener to a parcelable object */ - @NonNull - static IOnStatusListener toAIDL(@Nullable final OnStatusListener listener) { - return new IOnStatusListener.Stub() { - @Override - public void onComplete(final StatusParcelable statusParcelable) { - if (null != listener) { - listener.onComplete(new Status(statusParcelable)); - } - } - - @Override - public int getInterfaceVersion() { - return this.VERSION; - } - }; - } -} diff --git a/services/net/java/android/net/ipmemorystore/SameL3NetworkResponse.java b/services/net/java/android/net/ipmemorystore/SameL3NetworkResponse.java deleted file mode 100644 index 291aca8fc611..000000000000 --- a/services/net/java/android/net/ipmemorystore/SameL3NetworkResponse.java +++ /dev/null @@ -1,147 +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.net.ipmemorystore; - -import android.annotation.IntDef; -import android.annotation.NonNull; -import android.annotation.Nullable; - -import com.android.internal.annotations.VisibleForTesting; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.Objects; - -/** - * An object representing the answer to a query whether two given L2 networks represent the - * same L3 network. Parcels as a SameL3NetworkResponseParceled object. - * @hide - */ -public class SameL3NetworkResponse { - @IntDef(prefix = "NETWORK_", - value = {NETWORK_SAME, NETWORK_DIFFERENT, NETWORK_NEVER_CONNECTED}) - @Retention(RetentionPolicy.SOURCE) - public @interface NetworkSameness {} - - /** - * Both L2 networks represent the same L3 network. - */ - public static final int NETWORK_SAME = 1; - - /** - * The two L2 networks represent a different L3 network. - */ - public static final int NETWORK_DIFFERENT = 2; - - /** - * The device has never connected to at least one of these two L2 networks, or data - * has been wiped. Therefore the device has never seen the L3 network behind at least - * one of these two L2 networks, and can't evaluate whether it's the same as the other. - */ - public static final int NETWORK_NEVER_CONNECTED = 3; - - /** - * The first L2 key specified in the query. - */ - @NonNull - public final String l2Key1; - - /** - * The second L2 key specified in the query. - */ - @NonNull - public final String l2Key2; - - /** - * A confidence value indicating whether the two L2 networks represent the same L3 network. - * - * If both L2 networks were known, this value will be between 0.0 and 1.0, with 0.0 - * representing complete confidence that the given L2 networks represent a different - * L3 network, and 1.0 representing complete confidence that the given L2 networks - * represent the same L3 network. - * If at least one of the L2 networks was not known, this value will be outside of the - * 0.0~1.0 range. - * - * Most apps should not be interested in this, and are encouraged to use the collapsing - * {@link #getNetworkSameness()} function below. - */ - public final float confidence; - - /** - * @return whether the two L2 networks represent the same L3 network. Either - * {@code NETWORK_SAME}, {@code NETWORK_DIFFERENT} or {@code NETWORK_NEVER_CONNECTED}. - */ - @NetworkSameness - public final int getNetworkSameness() { - if (confidence > 1.0 || confidence < 0.0) return NETWORK_NEVER_CONNECTED; - return confidence > 0.5 ? NETWORK_SAME : NETWORK_DIFFERENT; - } - - /** @hide */ - public SameL3NetworkResponse(@NonNull final String l2Key1, @NonNull final String l2Key2, - final float confidence) { - this.l2Key1 = l2Key1; - this.l2Key2 = l2Key2; - this.confidence = confidence; - } - - /** Builds a SameL3NetworkResponse from a parcelable object */ - @VisibleForTesting - public SameL3NetworkResponse(@NonNull final SameL3NetworkResponseParcelable parceled) { - this(parceled.l2Key1, parceled.l2Key2, parceled.confidence); - } - - /** Converts this SameL3NetworkResponse to a parcelable object */ - @NonNull - public SameL3NetworkResponseParcelable toParcelable() { - final SameL3NetworkResponseParcelable parcelable = new SameL3NetworkResponseParcelable(); - parcelable.l2Key1 = l2Key1; - parcelable.l2Key2 = l2Key2; - parcelable.confidence = confidence; - return parcelable; - } - - // Note key1 and key2 have to match each other for this to return true. If - // key1 matches o.key2 and the other way around this returns false. - @Override - public boolean equals(@Nullable final Object o) { - if (!(o instanceof SameL3NetworkResponse)) return false; - final SameL3NetworkResponse other = (SameL3NetworkResponse) o; - return l2Key1.equals(other.l2Key1) && l2Key2.equals(other.l2Key2) - && confidence == other.confidence; - } - - @Override - public int hashCode() { - return Objects.hash(l2Key1, l2Key2, confidence); - } - - @Override - /** Pretty print */ - public String toString() { - switch (getNetworkSameness()) { - case NETWORK_SAME: - return "\"" + l2Key1 + "\" same L3 network as \"" + l2Key2 + "\""; - case NETWORK_DIFFERENT: - return "\"" + l2Key1 + "\" different L3 network from \"" + l2Key2 + "\""; - case NETWORK_NEVER_CONNECTED: - return "\"" + l2Key1 + "\" can't be tested against \"" + l2Key2 + "\""; - default: - return "Buggy sameness value ? \"" + l2Key1 + "\", \"" + l2Key2 + "\""; - } - } -} diff --git a/services/net/java/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/java/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl deleted file mode 100644 index 71966998a68a..000000000000 --- a/services/net/java/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl +++ /dev/null @@ -1,24 +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.net.ipmemorystore; - -/** {@hide} */ -parcelable SameL3NetworkResponseParcelable { - String l2Key1; - String l2Key2; - float confidence; -} diff --git a/services/net/java/android/net/ipmemorystore/Status.java b/services/net/java/android/net/ipmemorystore/Status.java deleted file mode 100644 index 13242c03ce01..000000000000 --- a/services/net/java/android/net/ipmemorystore/Status.java +++ /dev/null @@ -1,74 +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.net.ipmemorystore; - -import android.annotation.NonNull; - -import com.android.internal.annotations.VisibleForTesting; - -/** - * A parcelable status representing the result of an operation. - * Parcels as StatusParceled. - * @hide - */ -public class Status { - public static final int SUCCESS = 0; - - public static final int ERROR_GENERIC = -1; - public static final int ERROR_ILLEGAL_ARGUMENT = -2; - public static final int ERROR_DATABASE_CANNOT_BE_OPENED = -3; - public static final int ERROR_STORAGE = -4; - public static final int ERROR_UNKNOWN = -5; - - public final int resultCode; - - public Status(final int resultCode) { - this.resultCode = resultCode; - } - - @VisibleForTesting - public Status(@NonNull final StatusParcelable parcelable) { - this(parcelable.resultCode); - } - - /** Converts this Status to a parcelable object */ - @NonNull - public StatusParcelable toParcelable() { - final StatusParcelable parcelable = new StatusParcelable(); - parcelable.resultCode = resultCode; - return parcelable; - } - - public boolean isSuccess() { - return SUCCESS == resultCode; - } - - /** Pretty print */ - @Override - public String toString() { - switch (resultCode) { - case SUCCESS: return "SUCCESS"; - case ERROR_GENERIC: return "GENERIC ERROR"; - case ERROR_ILLEGAL_ARGUMENT: return "ILLEGAL ARGUMENT"; - case ERROR_DATABASE_CANNOT_BE_OPENED: return "DATABASE CANNOT BE OPENED"; - // "DB storage error" is not very helpful but SQLite does not provide specific error - // codes upon store failure. Thus this indicates SQLite returned some error upon store - case ERROR_STORAGE: return "DATABASE STORAGE ERROR"; - default: return "Unknown value ?!"; - } - } -} diff --git a/services/net/java/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/java/android/net/ipmemorystore/StatusParcelable.aidl deleted file mode 100644 index fb36ef4a56ff..000000000000 --- a/services/net/java/android/net/ipmemorystore/StatusParcelable.aidl +++ /dev/null @@ -1,22 +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.net.ipmemorystore; - -/** {@hide} */ -parcelable StatusParcelable { - int resultCode; -} diff --git a/tests/FlickerTests/AndroidManifest.xml b/tests/FlickerTests/AndroidManifest.xml index 5b1a36b84cc4..9b73abfd6908 100644 --- a/tests/FlickerTests/AndroidManifest.xml +++ b/tests/FlickerTests/AndroidManifest.xml @@ -23,6 +23,8 @@ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- Capture screen contents --> <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> + <!-- Enable / Disable tracing !--> + <uses-permission android:name="android.permission.DUMP" /> <!-- Run layers trace --> <uses-permission android:name="android.permission.HARDWARE_TEST"/> <application> @@ -33,4 +35,4 @@ android:targetPackage="com.android.server.wm.flicker" android:label="WindowManager Flicker Tests"> </instrumentation> -</manifest>
\ No newline at end of file +</manifest> diff --git a/tests/FlickerTests/AndroidTest.xml b/tests/FlickerTests/AndroidTest.xml index e36f97656f2a..d433df56bc00 100644 --- a/tests/FlickerTests/AndroidTest.xml +++ b/tests/FlickerTests/AndroidTest.xml @@ -25,5 +25,6 @@ <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> <option name="directory-keys" value="/sdcard/flicker" /> <option name="collect-on-run-ended-only" value="true" /> + <option name="clean-up" value="false" /> </metrics_collector> </configuration> diff --git a/tests/FlickerTests/lib/Android.bp b/tests/FlickerTests/lib/Android.bp deleted file mode 100644 index e0f0188ee618..000000000000 --- a/tests/FlickerTests/lib/Android.bp +++ /dev/null @@ -1,57 +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. -// - -java_test { - name: "flickerlib", - platform_apis: true, - srcs: ["src/**/*.java"], - static_libs: [ - "androidx.test.janktesthelper", - "cts-wm-util", - "platformprotosnano", - "layersprotosnano", - "truth-prebuilt", - "sysui-helper", - "launcher-helper-lib", - ], -} - -java_library { - name: "flickerlib_without_helpers", - platform_apis: true, - srcs: ["src/**/*.java"], - exclude_srcs: ["src/**/helpers/*.java"], - static_libs: [ - "cts-wm-util", - "platformprotosnano", - "layersprotosnano", - "truth-prebuilt" - ], -} - -java_library { - name: "flickerautomationhelperlib", - sdk_version: "test_current", - srcs: [ - "src/com/android/server/wm/flicker/helpers/AutomationUtils.java", - "src/com/android/server/wm/flicker/WindowUtils.java", - ], - static_libs: [ - "sysui-helper", - "launcher-helper-lib", - "compatibility-device-util-axt", - ], -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/Assertions.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/Assertions.java deleted file mode 100644 index 38255ee6fe8d..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/Assertions.java +++ /dev/null @@ -1,134 +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 com.android.server.wm.flicker; - -import java.util.concurrent.TimeUnit; -import java.util.function.Function; - -/** - * Collection of functional interfaces and classes representing assertions and their associated - * results. Assertions are functions that are applied over a single trace entry and returns a - * result which includes a detailed reason if the assertion fails. - */ -public class Assertions { - /** - * Checks assertion on a single trace entry. - * - * @param <T> trace entry type to perform the assertion on. - */ - @FunctionalInterface - public interface TraceAssertion<T> extends Function<T, Result> { - /** - * Returns an assertion that represents the logical negation of this assertion. - * - * @return a assertion that represents the logical negation of this assertion - */ - default TraceAssertion<T> negate() { - return (T t) -> apply(t).negate(); - } - } - - /** - * Checks assertion on a single layers trace entry. - */ - @FunctionalInterface - public interface LayersTraceAssertion extends TraceAssertion<LayersTrace.Entry> { - - } - - /** - * Utility class to store assertions with an identifier to help generate more useful debug - * data when dealing with multiple assertions. - */ - public static class NamedAssertion<T> { - public final TraceAssertion<T> assertion; - public final String name; - - public NamedAssertion(TraceAssertion<T> assertion, String name) { - this.assertion = assertion; - this.name = name; - } - } - - /** - * Contains the result of an assertion including the reason for failed assertions. - */ - public static class Result { - public static final String NEGATION_PREFIX = "!"; - public final boolean success; - public final long timestamp; - public final String assertionName; - public final String reason; - - public Result(boolean success, long timestamp, String assertionName, String reason) { - this.success = success; - this.timestamp = timestamp; - this.assertionName = assertionName; - this.reason = reason; - } - - public Result(boolean success, String reason) { - this.success = success; - this.reason = reason; - this.assertionName = ""; - this.timestamp = 0; - } - - /** - * Returns the negated {@code Result} and adds a negation prefix to the assertion name. - */ - public Result negate() { - String negatedAssertionName; - if (this.assertionName.startsWith(NEGATION_PREFIX)) { - negatedAssertionName = this.assertionName.substring(NEGATION_PREFIX.length() + 1); - } else { - negatedAssertionName = NEGATION_PREFIX + this.assertionName; - } - return new Result(!this.success, this.timestamp, negatedAssertionName, this.reason); - } - - public boolean passed() { - return this.success; - } - - public boolean failed() { - return !this.success; - } - - @Override - public String toString() { - return "Timestamp: " + prettyTimestamp(timestamp) - + "\nAssertion: " + assertionName - + "\nReason: " + reason; - } - - private String prettyTimestamp(long timestamp_ns) { - StringBuilder prettyTimestamp = new StringBuilder(); - TimeUnit[] timeUnits = {TimeUnit.HOURS, TimeUnit.MINUTES, TimeUnit.SECONDS, TimeUnit - .MILLISECONDS}; - String[] unitSuffixes = {"h", "m", "s", "ms"}; - - for (int i = 0; i < timeUnits.length; i++) { - long convertedTime = timeUnits[i].convert(timestamp_ns, TimeUnit.NANOSECONDS); - timestamp_ns -= TimeUnit.NANOSECONDS.convert(convertedTime, timeUnits[i]); - prettyTimestamp.append(convertedTime).append(unitSuffixes[i]); - } - - return prettyTimestamp.toString(); - } - } -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/AssertionsChecker.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/AssertionsChecker.java deleted file mode 100644 index 5c4df81299c1..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/AssertionsChecker.java +++ /dev/null @@ -1,183 +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 com.android.server.wm.flicker; - -import com.android.server.wm.flicker.Assertions.NamedAssertion; -import com.android.server.wm.flicker.Assertions.Result; -import com.android.server.wm.flicker.Assertions.TraceAssertion; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * Captures some of the common logic in {@link LayersTraceSubject} and {@link WmTraceSubject} - * used to filter trace entries and combine multiple assertions. - * - * @param <T> trace entry type - */ -public class AssertionsChecker<T extends ITraceEntry> { - private boolean mFilterEntriesByRange = false; - private long mFilterStartTime = 0; - private long mFilterEndTime = 0; - private AssertionOption mOption = AssertionOption.NONE; - private List<NamedAssertion<T>> mAssertions = new LinkedList<>(); - - public void add(Assertions.TraceAssertion<T> assertion, String name) { - mAssertions.add(new NamedAssertion<>(assertion, name)); - } - - public void filterByRange(long startTime, long endTime) { - mFilterEntriesByRange = true; - mFilterStartTime = startTime; - mFilterEndTime = endTime; - } - - private void setOption(AssertionOption option) { - if (mOption != AssertionOption.NONE && option != mOption) { - throw new IllegalArgumentException("Cannot use " + mOption + " option with " - + option + " option."); - } - mOption = option; - } - - public void checkFirstEntry() { - setOption(AssertionOption.CHECK_FIRST_ENTRY); - } - - public void checkLastEntry() { - setOption(AssertionOption.CHECK_LAST_ENTRY); - } - - public void checkChangingAssertions() { - setOption(AssertionOption.CHECK_CHANGING_ASSERTIONS); - } - - - /** - * Filters trace entries then runs assertions returning a list of failures. - * - * @param entries list of entries to perform assertions on - * @return list of failed assertion results - */ - public List<Result> test(List<T> entries) { - List<T> filteredEntries; - List<Result> failures; - - if (mFilterEntriesByRange) { - filteredEntries = entries.stream() - .filter(e -> ((e.getTimestamp() >= mFilterStartTime) - && (e.getTimestamp() <= mFilterEndTime))) - .collect(Collectors.toList()); - } else { - filteredEntries = entries; - } - - switch (mOption) { - case CHECK_CHANGING_ASSERTIONS: - return assertChanges(filteredEntries); - case CHECK_FIRST_ENTRY: - return assertEntry(filteredEntries.get(0)); - case CHECK_LAST_ENTRY: - return assertEntry(filteredEntries.get(filteredEntries.size() - 1)); - } - return assertAll(filteredEntries); - } - - /** - * Steps through each trace entry checking if provided assertions are true in the order they - * are added. Each assertion must be true for at least a single trace entry. - * - * This can be used to check for asserting a change in property over a trace. Such as visibility - * for a window changes from true to false or top-most window changes from A to Bb and back to A - * again. - */ - private List<Result> assertChanges(List<T> entries) { - List<Result> failures = new ArrayList<>(); - int entryIndex = 0; - int assertionIndex = 0; - int lastPassedAssertionIndex = -1; - - if (mAssertions.size() == 0) { - return failures; - } - - while (assertionIndex < mAssertions.size() && entryIndex < entries.size()) { - TraceAssertion<T> currentAssertion = mAssertions.get(assertionIndex).assertion; - Result result = currentAssertion.apply(entries.get(entryIndex)); - if (result.passed()) { - lastPassedAssertionIndex = assertionIndex; - entryIndex++; - continue; - } - - if (lastPassedAssertionIndex != assertionIndex) { - failures.add(result); - break; - } - assertionIndex++; - - if (assertionIndex == mAssertions.size()) { - failures.add(result); - break; - } - } - - if (failures.isEmpty()) { - if (assertionIndex != mAssertions.size() - 1) { - String reason = "\nAssertion " + mAssertions.get(assertionIndex).name - + " never became false"; - reason += "\nPassed assertions: " + mAssertions.stream().limit(assertionIndex) - .map(assertion -> assertion.name).collect(Collectors.joining(",")); - reason += "\nUntested assertions: " + mAssertions.stream().skip(assertionIndex + 1) - .map(assertion -> assertion.name).collect(Collectors.joining(",")); - - Result result = new Result(false /* success */, 0 /* timestamp */, - "assertChanges", "Not all assertions passed." + reason); - failures.add(result); - } - } - return failures; - } - - private List<Result> assertEntry(T entry) { - List<Result> failures = new ArrayList<>(); - for (NamedAssertion<T> assertion : mAssertions) { - Result result = assertion.assertion.apply(entry); - if (result.failed()) { - failures.add(result); - } - } - return failures; - } - - private List<Result> assertAll(List<T> entries) { - return mAssertions.stream().flatMap( - assertion -> entries.stream() - .map(assertion.assertion) - .filter(Result::failed)) - .collect(Collectors.toList()); - } - - private enum AssertionOption { - NONE, - CHECK_CHANGING_ASSERTIONS, - CHECK_FIRST_ENTRY, - CHECK_LAST_ENTRY, - } -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/ITraceEntry.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/ITraceEntry.java deleted file mode 100644 index c47f7f42e54e..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/ITraceEntry.java +++ /dev/null @@ -1,27 +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 com.android.server.wm.flicker; - -/** - * Common interface for Layer and WindowManager trace entries. - */ -public interface ITraceEntry { - /** - * @return timestamp of current entry - */ - long getTimestamp(); -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/LayersTrace.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/LayersTrace.java deleted file mode 100644 index 68986d48783a..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/LayersTrace.java +++ /dev/null @@ -1,420 +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 com.android.server.wm.flicker; - -import android.graphics.Rect; -import android.surfaceflinger.nano.Layers.LayerProto; -import android.surfaceflinger.nano.Layers.RectProto; -import android.surfaceflinger.nano.Layers.RegionProto; -import android.surfaceflinger.nano.Layerstrace.LayersTraceFileProto; -import android.surfaceflinger.nano.Layerstrace.LayersTraceProto; -import android.util.SparseArray; - -import androidx.annotation.Nullable; - -import com.android.server.wm.flicker.Assertions.Result; - -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - * Contains a collection of parsed Layers trace entries and assertions to apply over - * a single entry. - * - * Each entry is parsed into a list of {@link LayersTrace.Entry} objects. - */ -public class LayersTrace { - final private List<Entry> mEntries; - @Nullable - final private Path mSource; - - private LayersTrace(List<Entry> entries, Path source) { - this.mEntries = entries; - this.mSource = source; - } - - /** - * Parses {@code LayersTraceFileProto} from {@code data} and uses the proto to generates a list - * of trace entries, storing the flattened layers into its hierarchical structure. - * - * @param data binary proto data - * @param source Path to source of data for additional debug information - */ - public static LayersTrace parseFrom(byte[] data, Path source) { - List<Entry> entries = new ArrayList<>(); - LayersTraceFileProto fileProto; - try { - fileProto = LayersTraceFileProto.parseFrom(data); - } catch (Exception e) { - throw new RuntimeException(e); - } - for (LayersTraceProto traceProto : fileProto.entry) { - Entry entry = Entry.fromFlattenedLayers(traceProto.elapsedRealtimeNanos, - traceProto.layers.layers); - entries.add(entry); - } - return new LayersTrace(entries, source); - } - - /** - * Parses {@code LayersTraceFileProto} from {@code data} and uses the proto to generates a list - * of trace entries, storing the flattened layers into its hierarchical structure. - * - * @param data binary proto data - */ - public static LayersTrace parseFrom(byte[] data) { - return parseFrom(data, null); - } - - public List<Entry> getEntries() { - return mEntries; - } - - public Entry getEntry(long timestamp) { - Optional<Entry> entry = mEntries.stream() - .filter(e -> e.getTimestamp() == timestamp) - .findFirst(); - if (!entry.isPresent()) { - throw new RuntimeException("Entry does not exist for timestamp " + timestamp); - } - return entry.get(); - } - - public Optional<Path> getSource() { - return Optional.ofNullable(mSource); - } - - /** - * Represents a single Layer trace entry. - */ - public static class Entry implements ITraceEntry { - private long mTimestamp; - private List<Layer> mRootLayers; // hierarchical representation of layers - private List<Layer> mFlattenedLayers = null; - - private Entry(long timestamp, List<Layer> rootLayers) { - this.mTimestamp = timestamp; - this.mRootLayers = rootLayers; - } - - /** - * Constructs the layer hierarchy from a flattened list of layers. - */ - public static Entry fromFlattenedLayers(long timestamp, LayerProto[] protos) { - SparseArray<Layer> layerMap = new SparseArray<>(); - ArrayList<Layer> orphans = new ArrayList<>(); - for (LayerProto proto : protos) { - int id = proto.id; - int parentId = proto.parent; - - Layer newLayer = layerMap.get(id); - if (newLayer == null) { - newLayer = new Layer(proto); - layerMap.append(id, newLayer); - } else if (newLayer.mProto != null) { - throw new RuntimeException("Duplicate layer id found:" + id); - } else { - newLayer.mProto = proto; - orphans.remove(newLayer); - } - - // add parent placeholder - if (layerMap.get(parentId) == null) { - Layer orphanLayer = new Layer(null); - layerMap.append(parentId, orphanLayer); - orphans.add(orphanLayer); - } - layerMap.get(parentId).addChild(newLayer); - newLayer.addParent(layerMap.get(parentId)); - } - - // Fail if we find orphan layers. - orphans.remove(layerMap.get(-1)); - orphans.forEach(orphan -> { - String childNodes = orphan.mChildren.stream().map(node -> - Integer.toString(node.getId())).collect(Collectors.joining(", ")); - int orphanId = orphan.mChildren.get(0).mProto.parent; - throw new RuntimeException( - "Failed to parse layers trace. Found orphan layers with parent " - + "layer id:" + orphanId + " : " + childNodes); - }); - - return new Entry(timestamp, layerMap.get(-1).mChildren); - } - - /** - * Extracts {@link Rect} from {@link RectProto}. - */ - private static Rect extract(RectProto proto) { - return new Rect(proto.left, proto.top, proto.right, proto.bottom); - } - - /** - * Extracts {@link Rect} from {@link RegionProto} by returning a rect that encompasses all - * the rects making up the region. - */ - private static Rect extract(RegionProto regionProto) { - Rect region = new Rect(); - for (RectProto proto : regionProto.rect) { - region.union(proto.left, proto.top, proto.right, proto.bottom); - } - return region; - } - - /** - * Checks if a region specified by {@code testRect} is covered by all visible layers. - */ - public Result coversRegion(Rect testRect) { - String assertionName = "coversRegion"; - Collection<Layer> layers = asFlattenedLayers(); - - for (int x = testRect.left; x < testRect.right; x++) { - for (int y = testRect.top; y < testRect.bottom; y++) { - boolean emptyRegionFound = true; - for (Layer layer : layers) { - if (layer.isInvisible() || layer.isHiddenByParent()) { - continue; - } - for (RectProto rectProto : layer.mProto.visibleRegion.rect) { - Rect r = extract(rectProto); - if (r.contains(x, y)) { - y = r.bottom; - emptyRegionFound = false; - } - } - } - if (emptyRegionFound) { - String reason = "Region to test: " + testRect - + "\nfirst empty point: " + x + ", " + y; - reason += "\nvisible regions:"; - for (Layer layer : layers) { - if (layer.isInvisible() || layer.isHiddenByParent()) { - continue; - } - Rect r = extract(layer.mProto.visibleRegion); - reason += "\n" + layer.mProto.name + r.toString(); - } - return new Result(false /* success */, this.mTimestamp, assertionName, - reason); - } - } - } - String info = "Region covered: " + testRect; - return new Result(true /* success */, this.mTimestamp, assertionName, info); - } - - /** - * Checks if a layer with name {@code layerName} has a visible region - * {@code expectedVisibleRegion}. - */ - public Result hasVisibleRegion(String layerName, Rect expectedVisibleRegion) { - String assertionName = "hasVisibleRegion"; - String reason = "Could not find " + layerName; - for (Layer layer : asFlattenedLayers()) { - if (layer.mProto.name.contains(layerName)) { - if (layer.isHiddenByParent()) { - reason = layer.getHiddenByParentReason(); - continue; - } - if (layer.isInvisible()) { - reason = layer.getVisibilityReason(); - continue; - } - Rect visibleRegion = extract(layer.mProto.visibleRegion); - if (visibleRegion.equals(expectedVisibleRegion)) { - return new Result(true /* success */, this.mTimestamp, assertionName, - layer.mProto.name + "has visible region " + expectedVisibleRegion); - } - reason = layer.mProto.name + " has visible region:" + visibleRegion + " " - + "expected:" + expectedVisibleRegion; - } - } - return new Result(false /* success */, this.mTimestamp, assertionName, reason); - } - - /** - * Checks if a layer with name {@code layerName} is visible. - */ - public Result isVisible(String layerName) { - String assertionName = "isVisible"; - String reason = "Could not find " + layerName; - for (Layer layer : asFlattenedLayers()) { - if (layer.mProto.name.contains(layerName)) { - if (layer.isHiddenByParent()) { - reason = layer.getHiddenByParentReason(); - continue; - } - if (layer.isInvisible()) { - reason = layer.getVisibilityReason(); - continue; - } - return new Result(true /* success */, this.mTimestamp, assertionName, - layer.mProto.name + " is visible"); - } - } - return new Result(false /* success */, this.mTimestamp, assertionName, reason); - } - - @Override - public long getTimestamp() { - return mTimestamp; - } - - public List<Layer> getRootLayers() { - return mRootLayers; - } - - /** - * Returns all layers as a flattened list using a depth first traversal. - */ - public List<Layer> asFlattenedLayers() { - if (mFlattenedLayers == null) { - mFlattenedLayers = new LinkedList<>(); - ArrayList<Layer> pendingLayers = new ArrayList<>(this.mRootLayers); - while (!pendingLayers.isEmpty()) { - Layer layer = pendingLayers.remove(0); - mFlattenedLayers.add(layer); - pendingLayers.addAll(0, layer.mChildren); - } - } - return mFlattenedLayers; - } - - public Rect getVisibleBounds(String layerName) { - List<Layer> layers = asFlattenedLayers(); - for (Layer layer : layers) { - if (layer.mProto.name.contains(layerName) && layer.isVisible()) { - return extract(layer.mProto.visibleRegion); - } - } - return new Rect(0, 0, 0, 0); - } - } - - /** - * Represents a single layer with links to its parent and child layers. - */ - public static class Layer { - @Nullable - public LayerProto mProto; - public List<Layer> mChildren; - @Nullable - public Layer mParent = null; - - private Layer(LayerProto proto) { - this.mProto = proto; - this.mChildren = new ArrayList<>(); - } - - private void addChild(Layer childLayer) { - this.mChildren.add(childLayer); - } - - private void addParent(Layer parentLayer) { - this.mParent = parentLayer; - } - - public int getId() { - return mProto.id; - } - - public boolean isActiveBufferEmpty() { - return this.mProto.activeBuffer == null || this.mProto.activeBuffer.height == 0 - || this.mProto.activeBuffer.width == 0; - } - - public boolean isVisibleRegionEmpty() { - if (this.mProto.visibleRegion == null) { - return true; - } - Rect visibleRect = Entry.extract(this.mProto.visibleRegion); - return visibleRect.height() == 0 || visibleRect.width() == 0; - } - - public boolean isHidden() { - return (this.mProto.flags & /* FLAG_HIDDEN */ 0x1) != 0x0; - } - - public boolean isVisible() { - return (!isActiveBufferEmpty() || isColorLayer()) - && !isHidden() - && this.mProto.color != null - && this.mProto.color.a > 0 - && !isVisibleRegionEmpty(); - } - - public boolean isColorLayer() { - return this.mProto.type.equals("ColorLayer"); - } - - public boolean isRootLayer() { - return mParent == null || mParent.mProto == null; - } - - public boolean isInvisible() { - return !isVisible(); - } - - public boolean isHiddenByParent() { - return !isRootLayer() && (mParent.isHidden() || mParent.isHiddenByParent()); - } - - public String getHiddenByParentReason() { - String reason = "Layer " + mProto.name; - if (isHiddenByParent()) { - reason += " is hidden by parent: " + mParent.mProto.name; - } else { - reason += " is not hidden by parent: " + mParent.mProto.name; - } - return reason; - } - - public String getVisibilityReason() { - String reason = "Layer " + mProto.name; - if (isVisible()) { - reason += " is visible:"; - } else { - reason += " is invisible:"; - if (this.mProto.activeBuffer == null) { - reason += " activeBuffer=null"; - } else if (this.mProto.activeBuffer.height == 0) { - reason += " activeBuffer.height=0"; - } else if (this.mProto.activeBuffer.width == 0) { - reason += " activeBuffer.width=0"; - } - if (!isColorLayer()) { - reason += " type != ColorLayer"; - } - if (isHidden()) { - reason += " flags=" + this.mProto.flags + " (FLAG_HIDDEN set)"; - } - if (this.mProto.color == null || this.mProto.color.a == 0) { - reason += " color.a=0"; - } - if (isVisibleRegionEmpty()) { - reason += " visible region is empty"; - } - } - return reason; - } - } -}
\ No newline at end of file diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/LayersTraceSubject.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/LayersTraceSubject.java deleted file mode 100644 index 4a5129ed2269..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/LayersTraceSubject.java +++ /dev/null @@ -1,140 +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 com.android.server.wm.flicker; - -import static com.google.common.truth.Truth.assertAbout; -import static com.google.common.truth.Truth.assertWithMessage; - -import android.graphics.Rect; - -import androidx.annotation.Nullable; - -import com.android.server.wm.flicker.Assertions.Result; -import com.android.server.wm.flicker.LayersTrace.Entry; -import com.android.server.wm.flicker.TransitionRunner.TransitionResult; - -import com.google.common.truth.FailureMetadata; -import com.google.common.truth.Subject; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * Truth subject for {@link LayersTrace} objects. - */ -public class LayersTraceSubject extends Subject<LayersTraceSubject, LayersTrace> { - // Boiler-plate Subject.Factory for LayersTraceSubject - private static final Subject.Factory<LayersTraceSubject, LayersTrace> FACTORY = - new Subject.Factory<LayersTraceSubject, LayersTrace>() { - @Override - public LayersTraceSubject createSubject( - FailureMetadata fm, @Nullable LayersTrace target) { - return new LayersTraceSubject(fm, target); - } - }; - - private AssertionsChecker<Entry> mChecker = new AssertionsChecker<>(); - - private LayersTraceSubject(FailureMetadata fm, @Nullable LayersTrace subject) { - super(fm, subject); - } - - // User-defined entry point - public static LayersTraceSubject assertThat(@Nullable LayersTrace entry) { - return assertAbout(FACTORY).that(entry); - } - - // User-defined entry point - public static LayersTraceSubject assertThat(@Nullable TransitionResult result) { - LayersTrace entries = LayersTrace.parseFrom(result.getLayersTrace(), - result.getLayersTracePath()); - return assertWithMessage(result.toString()).about(FACTORY).that(entries); - } - - // Static method for getting the subject factory (for use with assertAbout()) - public static Subject.Factory<LayersTraceSubject, LayersTrace> entries() { - return FACTORY; - } - - public void forAllEntries() { - test(); - } - - public void forRange(long startTime, long endTime) { - mChecker.filterByRange(startTime, endTime); - test(); - } - - public LayersTraceSubject then() { - mChecker.checkChangingAssertions(); - return this; - } - - public void inTheBeginning() { - if (getSubject().getEntries().isEmpty()) { - fail("No entries found."); - } - mChecker.checkFirstEntry(); - test(); - } - - public void atTheEnd() { - if (getSubject().getEntries().isEmpty()) { - fail("No entries found."); - } - mChecker.checkLastEntry(); - test(); - } - - private void test() { - List<Result> failures = mChecker.test(getSubject().getEntries()); - if (!failures.isEmpty()) { - String failureLogs = failures.stream().map(Result::toString) - .collect(Collectors.joining("\n")); - String tracePath = ""; - if (getSubject().getSource().isPresent()) { - tracePath = "\nLayers Trace can be found in: " - + getSubject().getSource().get().toAbsolutePath() + "\n"; - } - fail(tracePath + failureLogs); - } - } - - public LayersTraceSubject coversRegion(Rect rect) { - mChecker.add(entry -> entry.coversRegion(rect), - "coversRegion(" + rect + ")"); - return this; - } - - public LayersTraceSubject hasVisibleRegion(String layerName, Rect size) { - mChecker.add(entry -> entry.hasVisibleRegion(layerName, size), - "hasVisibleRegion(" + layerName + size + ")"); - return this; - } - - public LayersTraceSubject showsLayer(String layerName) { - mChecker.add(entry -> entry.isVisible(layerName), - "showsLayer(" + layerName + ")"); - return this; - } - - public LayersTraceSubject hidesLayer(String layerName) { - mChecker.add(entry -> entry.isVisible(layerName).negate(), - "hidesLayer(" + layerName + ")"); - return this; - } -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/TransitionRunner.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/TransitionRunner.java deleted file mode 100644 index 241a1c04bdb8..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/TransitionRunner.java +++ /dev/null @@ -1,433 +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 com.android.server.wm.flicker; - -import static com.android.server.wm.flicker.monitor.ITransitionMonitor.OUTPUT_DIR; - -import android.util.Log; - -import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; -import androidx.test.InstrumentationRegistry; - -import com.android.server.wm.flicker.monitor.ITransitionMonitor; -import com.android.server.wm.flicker.monitor.LayersTraceMonitor; -import com.android.server.wm.flicker.monitor.ScreenRecorder; -import com.android.server.wm.flicker.monitor.WindowAnimationFrameStatsMonitor; -import com.android.server.wm.flicker.monitor.WindowManagerTraceMonitor; - -import com.google.common.io.Files; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -/** - * Builds and runs UI transitions capturing test artifacts. - * - * User can compose a transition from simpler steps, specifying setup and teardown steps. During - * a transition, Layers trace, WindowManager trace, screen recordings and window animation frame - * stats can be captured. - * - * <pre> - * Transition builder options: - * {@link TransitionBuilder#run(Runnable)} run transition under test. Monitors will be started - * before the transition and stopped after the transition is completed. - * {@link TransitionBuilder#repeat(int)} repeat transitions under test multiple times recording - * result for each run. - * {@link TransitionBuilder#withTag(String)} specify a string identifier used to prefix logs and - * artifacts generated. - * {@link TransitionBuilder#runBeforeAll(Runnable)} run setup transitions once before all other - * transition are run to set up an initial state on device. - * {@link TransitionBuilder#runBefore(Runnable)} run setup transitions before each test transition - * run. - * {@link TransitionBuilder#runAfter(Runnable)} run teardown transitions after each test - * transition. - * {@link TransitionBuilder#runAfter(Runnable)} run teardown transitions once after all - * other transition are run. - * {@link TransitionBuilder#includeJankyRuns()} disables {@link WindowAnimationFrameStatsMonitor} - * to monitor janky frames. If janky frames are detected, then the test run is skipped. This - * monitor is enabled by default. - * {@link TransitionBuilder#skipLayersTrace()} disables {@link LayersTraceMonitor} used to - * capture Layers trace during a transition. This monitor is enabled by default. - * {@link TransitionBuilder#skipWindowManagerTrace()} disables {@link WindowManagerTraceMonitor} - * used to capture WindowManager trace during a transition. This monitor is enabled by - * default. - * {@link TransitionBuilder#recordAllRuns()} records the screen contents and saves it to a file. - * All the runs including setup and teardown transitions are included in the recording. This - * monitor is used for debugging purposes. - * {@link TransitionBuilder#recordEachRun()} records the screen contents during test transitions - * and saves it to a file for each run. This monitor is used for debugging purposes. - * - * Example transition to capture WindowManager and Layers trace when opening a test app: - * {@code - * TransitionRunner.newBuilder() - * .withTag("OpenTestAppFast") - * .runBeforeAll(UiAutomationLib::wakeUp) - * .runBeforeAll(UiAutomationLib::UnlockDevice) - * .runBeforeAll(UiAutomationLib::openTestApp) - * .runBefore(UiAutomationLib::closeTestApp) - * .run(UiAutomationLib::openTestApp) - * .runAfterAll(UiAutomationLib::closeTestApp) - * .repeat(5) - * .build() - * .run(); - * } - * </pre> - */ -public class TransitionRunner { - private static final String TAG = "FLICKER"; - private final ScreenRecorder mScreenRecorder; - private final WindowManagerTraceMonitor mWmTraceMonitor; - private final LayersTraceMonitor mLayersTraceMonitor; - private final WindowAnimationFrameStatsMonitor mFrameStatsMonitor; - - private final List<ITransitionMonitor> mAllRunsMonitors; - private final List<ITransitionMonitor> mPerRunMonitors; - private final List<Runnable> mBeforeAlls; - private final List<Runnable> mBefores; - private final List<Runnable> mTransitions; - private final List<Runnable> mAfters; - private final List<Runnable> mAfterAlls; - - private final int mIterations; - private final String mTestTag; - - @Nullable - private List<TransitionResult> mResults = null; - - private TransitionRunner(TransitionBuilder builder) { - mScreenRecorder = builder.mScreenRecorder; - mWmTraceMonitor = builder.mWmTraceMonitor; - mLayersTraceMonitor = builder.mLayersTraceMonitor; - mFrameStatsMonitor = builder.mFrameStatsMonitor; - - mAllRunsMonitors = builder.mAllRunsMonitors; - mPerRunMonitors = builder.mPerRunMonitors; - mBeforeAlls = builder.mBeforeAlls; - mBefores = builder.mBefores; - mTransitions = builder.mTransitions; - mAfters = builder.mAfters; - mAfterAlls = builder.mAfterAlls; - - mIterations = builder.mIterations; - mTestTag = builder.mTestTag; - } - - public static TransitionBuilder newBuilder() { - return newBuilder(OUTPUT_DIR.toString()); - } - - public static TransitionBuilder newBuilder(String outputDir) { - return new TransitionBuilder(outputDir); - } - - /** - * Runs the composed transition and calls monitors at the appropriate stages. If jank monitor - * is enabled, transitions with jank are skipped. - * - * @return itself - */ - public TransitionRunner run() { - mResults = new ArrayList<>(); - mAllRunsMonitors.forEach(ITransitionMonitor::start); - mBeforeAlls.forEach(Runnable::run); - for (int iteration = 0; iteration < mIterations; iteration++) { - mBefores.forEach(Runnable::run); - mPerRunMonitors.forEach(ITransitionMonitor::start); - mTransitions.forEach(Runnable::run); - mPerRunMonitors.forEach(ITransitionMonitor::stop); - mAfters.forEach(Runnable::run); - if (runJankFree() && mFrameStatsMonitor.jankyFramesDetected()) { - String msg = String.format("Skipping iteration %d/%d for test %s due to jank. %s", - iteration, mIterations - 1, mTestTag, mFrameStatsMonitor.toString()); - Log.e(TAG, msg); - continue; - } - mResults.add(saveResult(iteration)); - } - mAfterAlls.forEach(Runnable::run); - mAllRunsMonitors.forEach(monitor -> { - monitor.stop(); - monitor.save(mTestTag); - }); - return this; - } - - /** - * Returns a list of transition results. - * - * @return list of transition results. - */ - public List<TransitionResult> getResults() { - if (mResults == null) { - throw new IllegalStateException("Results do not exist!"); - } - return mResults; - } - - /** - * Deletes all transition results that are not marked for saving. - * - * @return list of transition results. - */ - public void deleteResults() { - if (mResults == null) { - return; - } - mResults.stream() - .filter(TransitionResult::canDelete) - .forEach(TransitionResult::delete); - mResults = null; - } - - /** - * Saves monitor results to file. - * - * @return object containing paths to test artifacts - */ - private TransitionResult saveResult(int iteration) { - Path windowTrace = null; - Path layerTrace = null; - Path screenCaptureVideo = null; - - if (mPerRunMonitors.contains(mWmTraceMonitor)) { - windowTrace = mWmTraceMonitor.save(mTestTag, iteration); - } - if (mPerRunMonitors.contains(mLayersTraceMonitor)) { - layerTrace = mLayersTraceMonitor.save(mTestTag, iteration); - } - if (mPerRunMonitors.contains(mScreenRecorder)) { - screenCaptureVideo = mScreenRecorder.save(mTestTag, iteration); - } - return new TransitionResult(layerTrace, windowTrace, screenCaptureVideo); - } - - private boolean runJankFree() { - return mPerRunMonitors.contains(mFrameStatsMonitor); - } - - public String getTestTag() { - return mTestTag; - } - - /** - * Stores paths to all test artifacts. - */ - @VisibleForTesting - public static class TransitionResult { - @Nullable - public final Path layersTrace; - @Nullable - public final Path windowManagerTrace; - @Nullable - public final Path screenCaptureVideo; - private boolean flaggedForSaving; - - public TransitionResult(@Nullable Path layersTrace, @Nullable Path windowManagerTrace, - @Nullable Path screenCaptureVideo) { - this.layersTrace = layersTrace; - this.windowManagerTrace = windowManagerTrace; - this.screenCaptureVideo = screenCaptureVideo; - } - - public void flagForSaving() { - flaggedForSaving = true; - } - - public boolean canDelete() { - return !flaggedForSaving; - } - - public boolean layersTraceExists() { - return layersTrace != null && layersTrace.toFile().exists(); - } - - public byte[] getLayersTrace() { - try { - return Files.toByteArray(this.layersTrace.toFile()); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Path getLayersTracePath() { - return layersTrace; - } - - public boolean windowManagerTraceExists() { - return windowManagerTrace != null && windowManagerTrace.toFile().exists(); - } - - public byte[] getWindowManagerTrace() { - try { - return Files.toByteArray(this.windowManagerTrace.toFile()); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Path getWindowManagerTracePath() { - return windowManagerTrace; - } - - public boolean screenCaptureVideoExists() { - return screenCaptureVideo != null && screenCaptureVideo.toFile().exists(); - } - - public Path screenCaptureVideoPath() { - return screenCaptureVideo; - } - - public void delete() { - if (layersTraceExists()) layersTrace.toFile().delete(); - if (windowManagerTraceExists()) windowManagerTrace.toFile().delete(); - if (screenCaptureVideoExists()) screenCaptureVideo.toFile().delete(); - } - } - - /** - * Builds a {@link TransitionRunner} instance. - */ - public static class TransitionBuilder { - private ScreenRecorder mScreenRecorder; - private WindowManagerTraceMonitor mWmTraceMonitor; - private LayersTraceMonitor mLayersTraceMonitor; - private WindowAnimationFrameStatsMonitor mFrameStatsMonitor; - - private List<ITransitionMonitor> mAllRunsMonitors = new LinkedList<>(); - private List<ITransitionMonitor> mPerRunMonitors = new LinkedList<>(); - private List<Runnable> mBeforeAlls = new LinkedList<>(); - private List<Runnable> mBefores = new LinkedList<>(); - private List<Runnable> mTransitions = new LinkedList<>(); - private List<Runnable> mAfters = new LinkedList<>(); - private List<Runnable> mAfterAlls = new LinkedList<>(); - - private boolean mRunJankFree = true; - private boolean mCaptureWindowManagerTrace = true; - private boolean mCaptureLayersTrace = true; - private boolean mRecordEachRun = false; - private int mIterations = 1; - private String mTestTag = ""; - - private boolean mRecordAllRuns = false; - - public TransitionBuilder(String outputDir) { - mScreenRecorder = new ScreenRecorder(); - mWmTraceMonitor = new WindowManagerTraceMonitor(outputDir); - mLayersTraceMonitor = new LayersTraceMonitor(outputDir); - mFrameStatsMonitor = new - WindowAnimationFrameStatsMonitor(InstrumentationRegistry.getInstrumentation()); - } - - public TransitionRunner build() { - if (mCaptureWindowManagerTrace) { - mPerRunMonitors.add(mWmTraceMonitor); - } - - if (mCaptureLayersTrace) { - mPerRunMonitors.add(mLayersTraceMonitor); - } - - if (mRunJankFree) { - mPerRunMonitors.add(mFrameStatsMonitor); - } - - if (mRecordAllRuns) { - mAllRunsMonitors.add(mScreenRecorder); - } - - if (mRecordEachRun) { - mPerRunMonitors.add(mScreenRecorder); - } - - return new TransitionRunner(this); - } - - public TransitionBuilder runBeforeAll(Runnable runnable) { - mBeforeAlls.add(runnable); - return this; - } - - public TransitionBuilder runBefore(Runnable runnable) { - mBefores.add(runnable); - return this; - } - - public TransitionBuilder run(Runnable runnable) { - mTransitions.add(runnable); - return this; - } - - public TransitionBuilder runAfter(Runnable runnable) { - mAfters.add(runnable); - return this; - } - - public TransitionBuilder runAfterAll(Runnable runnable) { - mAfterAlls.add(runnable); - return this; - } - - public TransitionBuilder repeat(int iterations) { - mIterations = iterations; - return this; - } - - public TransitionBuilder skipWindowManagerTrace() { - mCaptureWindowManagerTrace = false; - return this; - } - - public TransitionBuilder skipLayersTrace() { - mCaptureLayersTrace = false; - return this; - } - - public TransitionBuilder includeJankyRuns() { - mRunJankFree = false; - return this; - } - - public TransitionBuilder recordEachRun() { - if (mRecordAllRuns) { - throw new IllegalArgumentException("Invalid option with recordAllRuns"); - } - mRecordEachRun = true; - return this; - } - - public TransitionBuilder recordAllRuns() { - if (mRecordEachRun) { - throw new IllegalArgumentException("Invalid option with recordEachRun"); - } - mRecordAllRuns = true; - return this; - } - - public TransitionBuilder withTag(String testTag) { - if (testTag.contains(" ")) { - throw new IllegalArgumentException("The test tag can not contain spaces since it " - + "is a part of the file name"); - } - mTestTag = testTag; - return this; - } - } -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WindowManagerTrace.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WindowManagerTrace.java deleted file mode 100644 index 412e72d82e55..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WindowManagerTrace.java +++ /dev/null @@ -1,240 +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 com.android.server.wm.flicker; - -import androidx.annotation.Nullable; - -import com.android.server.wm.flicker.Assertions.Result; -import com.android.server.wm.nano.AppWindowTokenProto; -import com.android.server.wm.nano.StackProto; -import com.android.server.wm.nano.TaskProto; -import com.android.server.wm.nano.WindowManagerTraceFileProto; -import com.android.server.wm.nano.WindowManagerTraceProto; -import com.android.server.wm.nano.WindowStateProto; -import com.android.server.wm.nano.WindowTokenProto; - -import com.google.protobuf.nano.InvalidProtocolBufferNanoException; - -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -/** - * Contains a collection of parsed WindowManager trace entries and assertions to apply over - * a single entry. - * - * Each entry is parsed into a list of {@link WindowManagerTrace.Entry} objects. - */ -public class WindowManagerTrace { - private static final int DEFAULT_DISPLAY = 0; - private final List<Entry> mEntries; - @Nullable - final private Path mSource; - - private WindowManagerTrace(List<Entry> entries, Path source) { - this.mEntries = entries; - this.mSource = source; - } - - /** - * Parses {@code WindowManagerTraceFileProto} from {@code data} and uses the proto to - * generates a list of trace entries. - * - * @param data binary proto data - * @param source Path to source of data for additional debug information - */ - public static WindowManagerTrace parseFrom(byte[] data, Path source) { - List<Entry> entries = new ArrayList<>(); - - WindowManagerTraceFileProto fileProto; - try { - fileProto = WindowManagerTraceFileProto.parseFrom(data); - } catch (InvalidProtocolBufferNanoException e) { - throw new RuntimeException(e); - } - for (WindowManagerTraceProto entryProto : fileProto.entry) { - entries.add(new Entry(entryProto)); - } - return new WindowManagerTrace(entries, source); - } - - public static WindowManagerTrace parseFrom(byte[] data) { - return parseFrom(data, null); - } - - public List<Entry> getEntries() { - return mEntries; - } - - public Entry getEntry(long timestamp) { - Optional<Entry> entry = mEntries.stream() - .filter(e -> e.getTimestamp() == timestamp) - .findFirst(); - if (!entry.isPresent()) { - throw new RuntimeException("Entry does not exist for timestamp " + timestamp); - } - return entry.get(); - } - - public Optional<Path> getSource() { - return Optional.ofNullable(mSource); - } - - /** - * Represents a single WindowManager trace entry. - */ - public static class Entry implements ITraceEntry { - private final WindowManagerTraceProto mProto; - - public Entry(WindowManagerTraceProto proto) { - mProto = proto; - } - - private static Result isWindowVisible(String windowTitle, - WindowTokenProto[] windowTokenProtos) { - boolean titleFound = false; - for (WindowTokenProto windowToken : windowTokenProtos) { - for (WindowStateProto windowState : windowToken.windows) { - if (windowState.identifier.title.contains(windowTitle)) { - titleFound = true; - if (isVisible(windowState)) { - return new Result(true /* success */, - windowState.identifier.title + " is visible"); - } - } - } - } - - String reason; - if (!titleFound) { - reason = windowTitle + " cannot be found"; - } else { - reason = windowTitle + " is invisible"; - } - return new Result(false /* success */, reason); - } - - private static boolean isVisible(WindowStateProto windowState) { - return windowState.windowContainer.visible; - } - - @Override - public long getTimestamp() { - return mProto.elapsedRealtimeNanos; - } - - /** - * Returns window title of the top most visible app window. - */ - private String getTopVisibleAppWindow() { - StackProto[] stacks = mProto.windowManagerService.rootWindowContainer - .displays[DEFAULT_DISPLAY].stacks; - for (StackProto stack : stacks) { - for (TaskProto task : stack.tasks) { - for (AppWindowTokenProto token : task.appWindowTokens) { - for (WindowStateProto windowState : token.windowToken.windows) { - if (windowState.windowContainer.visible) { - return task.appWindowTokens[0].name; - } - } - } - } - } - - return ""; - } - - /** - * Checks if aboveAppWindow with {@code windowTitle} is visible. - */ - public Result isAboveAppWindowVisible(String windowTitle) { - WindowTokenProto[] windowTokenProtos = mProto.windowManagerService - .rootWindowContainer - .displays[DEFAULT_DISPLAY].aboveAppWindows; - Result result = isWindowVisible(windowTitle, windowTokenProtos); - return new Result(result.success, getTimestamp(), "showsAboveAppWindow", result.reason); - } - - /** - * Checks if belowAppWindow with {@code windowTitle} is visible. - */ - public Result isBelowAppWindowVisible(String windowTitle) { - WindowTokenProto[] windowTokenProtos = mProto.windowManagerService - .rootWindowContainer - .displays[DEFAULT_DISPLAY].belowAppWindows; - Result result = isWindowVisible(windowTitle, windowTokenProtos); - return new Result(result.success, getTimestamp(), "isBelowAppWindowVisible", - result.reason); - } - - /** - * Checks if imeWindow with {@code windowTitle} is visible. - */ - public Result isImeWindowVisible(String windowTitle) { - WindowTokenProto[] windowTokenProtos = mProto.windowManagerService - .rootWindowContainer - .displays[DEFAULT_DISPLAY].imeWindows; - Result result = isWindowVisible(windowTitle, windowTokenProtos); - return new Result(result.success, getTimestamp(), "isImeWindowVisible", - result.reason); - } - - /** - * Checks if app window with {@code windowTitle} is on top. - */ - public Result isVisibleAppWindowOnTop(String windowTitle) { - String topAppWindow = getTopVisibleAppWindow(); - boolean success = topAppWindow.contains(windowTitle); - String reason = "wanted=" + windowTitle + " found=" + topAppWindow; - return new Result(success, getTimestamp(), "isAppWindowOnTop", reason); - } - - /** - * Checks if app window with {@code windowTitle} is visible. - */ - public Result isAppWindowVisible(String windowTitle) { - final String assertionName = "isAppWindowVisible"; - boolean titleFound = false; - StackProto[] stacks = mProto.windowManagerService.rootWindowContainer - .displays[DEFAULT_DISPLAY].stacks; - for (StackProto stack : stacks) { - for (TaskProto task : stack.tasks) { - for (AppWindowTokenProto token : task.appWindowTokens) { - if (token.name.contains(windowTitle)) { - titleFound = true; - for (WindowStateProto windowState : token.windowToken.windows) { - if (windowState.windowContainer.visible) { - return new Result(true /* success */, getTimestamp(), - assertionName, "Window " + token.name + - "is visible"); - } - } - } - } - } - } - String reason; - if (!titleFound) { - reason = "Window " + windowTitle + " cannot be found"; - } else { - reason = "Window " + windowTitle + " is invisible"; - } - return new Result(false /* success */, getTimestamp(), assertionName, reason); - } - } -}
\ No newline at end of file diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WindowUtils.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WindowUtils.java deleted file mode 100644 index 3d25fbed5135..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WindowUtils.java +++ /dev/null @@ -1,144 +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 com.android.server.wm.flicker; - -import android.content.Context; -import android.content.res.Resources; -import android.graphics.Point; -import android.graphics.Rect; -import android.view.Surface; -import android.view.WindowManager; - -import androidx.test.InstrumentationRegistry; - -/** - * Helper functions to retrieve system window sizes and positions. - */ -public class WindowUtils { - - public static Rect getDisplayBounds() { - Point display = new Point(); - WindowManager wm = - (WindowManager) InstrumentationRegistry.getContext().getSystemService( - Context.WINDOW_SERVICE); - wm.getDefaultDisplay().getRealSize(display); - return new Rect(0, 0, display.x, display.y); - } - - private static int getCurrentRotation() { - WindowManager wm = - (WindowManager) InstrumentationRegistry.getContext().getSystemService( - Context.WINDOW_SERVICE); - return wm.getDefaultDisplay().getRotation(); - } - - public static Rect getDisplayBounds(int requestedRotation) { - Rect displayBounds = getDisplayBounds(); - int currentDisplayRotation = getCurrentRotation(); - - boolean displayIsRotated = (currentDisplayRotation == Surface.ROTATION_90 || - currentDisplayRotation == Surface.ROTATION_270); - - boolean requestedDisplayIsRotated = requestedRotation == Surface.ROTATION_90 || - requestedRotation == Surface.ROTATION_270; - - // if the current orientation changes with the requested rotation, - // flip height and width of display bounds. - if (displayIsRotated != requestedDisplayIsRotated) { - return new Rect(0, 0, displayBounds.height(), displayBounds.width()); - } - - return new Rect(0, 0, displayBounds.width(), displayBounds.height()); - } - - - public static Rect getAppPosition(int requestedRotation) { - Rect displayBounds = getDisplayBounds(); - int currentDisplayRotation = getCurrentRotation(); - - boolean displayIsRotated = currentDisplayRotation == Surface.ROTATION_90 || - currentDisplayRotation == Surface.ROTATION_270; - - boolean requestedAppIsRotated = requestedRotation == Surface.ROTATION_90 || - requestedRotation == Surface.ROTATION_270; - - // display size will change if the display is reflected. Flip height and width of app if the - // requested rotation is different from the current rotation. - if (displayIsRotated != requestedAppIsRotated) { - return new Rect(0, 0, displayBounds.height(), displayBounds.width()); - } - - return new Rect(0, 0, displayBounds.width(), displayBounds.height()); - } - - public static Rect getStatusBarPosition(int requestedRotation) { - Resources resources = InstrumentationRegistry.getContext().getResources(); - String resourceName; - Rect displayBounds = getDisplayBounds(); - int width; - if (requestedRotation == Surface.ROTATION_0 || requestedRotation == Surface.ROTATION_180) { - resourceName = "status_bar_height_portrait"; - width = Math.min(displayBounds.width(), displayBounds.height()); - } else { - resourceName = "status_bar_height_landscape"; - width = Math.max(displayBounds.width(), displayBounds.height()); - } - - int resourceId = resources.getIdentifier(resourceName, "dimen", "android"); - int height = resources.getDimensionPixelSize(resourceId); - - return new Rect(0, 0, width, height); - } - - public static Rect getNavigationBarPosition(int requestedRotation) { - Resources resources = InstrumentationRegistry.getContext().getResources(); - Rect displayBounds = getDisplayBounds(); - int displayWidth = Math.min(displayBounds.width(), displayBounds.height()); - int displayHeight = Math.max(displayBounds.width(), displayBounds.height()); - int resourceId; - if (requestedRotation == Surface.ROTATION_0 || requestedRotation == Surface.ROTATION_180) { - resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); - int height = resources.getDimensionPixelSize(resourceId); - return new Rect(0, displayHeight - height, displayWidth, displayHeight); - } else { - resourceId = resources.getIdentifier("navigation_bar_width", "dimen", "android"); - int width = resources.getDimensionPixelSize(resourceId); - // swap display dimensions in landscape or seascape mode - int temp = displayHeight; - displayHeight = displayWidth; - displayWidth = temp; - if (requestedRotation == Surface.ROTATION_90) { - return new Rect(0, 0, width, displayHeight); - } else { - return new Rect(displayWidth - width, 0, displayWidth, displayHeight); - } - } - } - - public static int getNavigationBarHeight() { - Resources resources = InstrumentationRegistry.getContext().getResources(); - int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); - return resources.getDimensionPixelSize(resourceId); - } - - public static int getDockedStackDividerInset() { - Resources resources = InstrumentationRegistry.getContext().getResources(); - int resourceId = resources.getIdentifier("docked_stack_divider_insets", "dimen", - "android"); - return resources.getDimensionPixelSize(resourceId); - } -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WmTraceSubject.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WmTraceSubject.java deleted file mode 100644 index 064cc2702f39..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/WmTraceSubject.java +++ /dev/null @@ -1,192 +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 com.android.server.wm.flicker; - -import static com.google.common.truth.Truth.assertAbout; -import static com.google.common.truth.Truth.assertWithMessage; - -import androidx.annotation.Nullable; - -import com.android.server.wm.flicker.Assertions.Result; -import com.android.server.wm.flicker.TransitionRunner.TransitionResult; - -import com.google.common.truth.FailureMetadata; -import com.google.common.truth.Subject; - -import java.nio.file.Path; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - * Truth subject for {@link WindowManagerTrace} objects. - */ -public class WmTraceSubject extends Subject<WmTraceSubject, WindowManagerTrace> { - // Boiler-plate Subject.Factory for WmTraceSubject - private static final Subject.Factory<WmTraceSubject, WindowManagerTrace> FACTORY = - new Subject.Factory<WmTraceSubject, WindowManagerTrace>() { - @Override - public WmTraceSubject createSubject( - FailureMetadata fm, @Nullable WindowManagerTrace target) { - return new WmTraceSubject(fm, target); - } - }; - - private AssertionsChecker<WindowManagerTrace.Entry> mChecker = new AssertionsChecker<>(); - - private WmTraceSubject(FailureMetadata fm, @Nullable WindowManagerTrace subject) { - super(fm, subject); - } - - // User-defined entry point - public static WmTraceSubject assertThat(@Nullable WindowManagerTrace entry) { - return assertAbout(FACTORY).that(entry); - } - - // User-defined entry point - public static WmTraceSubject assertThat(@Nullable TransitionResult result) { - WindowManagerTrace entries = WindowManagerTrace.parseFrom(result.getWindowManagerTrace(), - result.getWindowManagerTracePath()); - return assertWithMessage(result.toString()).about(FACTORY).that(entries); - } - - // Static method for getting the subject factory (for use with assertAbout()) - public static Subject.Factory<WmTraceSubject, WindowManagerTrace> entries() { - return FACTORY; - } - - public void forAllEntries() { - test(); - } - - public void forRange(long startTime, long endTime) { - mChecker.filterByRange(startTime, endTime); - test(); - } - - public WmTraceSubject then() { - mChecker.checkChangingAssertions(); - return this; - } - - public void inTheBeginning() { - if (getSubject().getEntries().isEmpty()) { - fail("No entries found."); - } - mChecker.checkFirstEntry(); - test(); - } - - public void atTheEnd() { - if (getSubject().getEntries().isEmpty()) { - fail("No entries found."); - } - mChecker.checkLastEntry(); - test(); - } - - private void test() { - List<Result> failures = mChecker.test(getSubject().getEntries()); - if (!failures.isEmpty()) { - Optional<Path> failureTracePath = getSubject().getSource(); - String failureLogs = failures.stream().map(Result::toString) - .collect(Collectors.joining("\n")); - String tracePath = ""; - if (failureTracePath.isPresent()) { - tracePath = "\nWindowManager Trace can be found in: " - + failureTracePath.get().toAbsolutePath() + "\n"; - } - fail(tracePath + failureLogs); - } - } - - public WmTraceSubject showsAboveAppWindow(String partialWindowTitle) { - mChecker.add(entry -> entry.isAboveAppWindowVisible(partialWindowTitle), - "showsAboveAppWindow(" + partialWindowTitle + ")"); - return this; - } - - public WmTraceSubject hidesAboveAppWindow(String partialWindowTitle) { - mChecker.add(entry -> entry.isAboveAppWindowVisible(partialWindowTitle).negate(), - "hidesAboveAppWindow" + "(" + partialWindowTitle + ")"); - return this; - } - - public WmTraceSubject showsBelowAppWindow(String partialWindowTitle) { - mChecker.add(entry -> entry.isBelowAppWindowVisible(partialWindowTitle), - "showsBelowAppWindow(" + partialWindowTitle + ")"); - return this; - } - - public WmTraceSubject hidesBelowAppWindow(String partialWindowTitle) { - mChecker.add(entry -> entry.isBelowAppWindowVisible(partialWindowTitle).negate(), - "hidesBelowAppWindow" + "(" + partialWindowTitle + ")"); - return this; - } - - public WmTraceSubject showsImeWindow(String partialWindowTitle) { - mChecker.add(entry -> entry.isImeWindowVisible(partialWindowTitle), - "showsBelowAppWindow(" + partialWindowTitle + ")"); - return this; - } - - public WmTraceSubject hidesImeWindow(String partialWindowTitle) { - mChecker.add(entry -> entry.isImeWindowVisible(partialWindowTitle).negate(), - "hidesImeWindow" + "(" + partialWindowTitle + ")"); - return this; - } - - public WmTraceSubject showsAppWindowOnTop(String partialWindowTitle) { - mChecker.add( - entry -> { - Result result = entry.isAppWindowVisible(partialWindowTitle); - if (result.passed()) { - result = entry.isVisibleAppWindowOnTop(partialWindowTitle); - } - return result; - }, - "showsAppWindowOnTop(" + partialWindowTitle + ")" - ); - return this; - } - - public WmTraceSubject hidesAppWindowOnTop(String partialWindowTitle) { - mChecker.add( - entry -> { - Result result = entry.isAppWindowVisible(partialWindowTitle).negate(); - if (result.failed()) { - result = entry.isVisibleAppWindowOnTop(partialWindowTitle).negate(); - } - return result; - }, - "hidesAppWindowOnTop(" + partialWindowTitle + ")" - ); - return this; - } - - public WmTraceSubject showsAppWindow(String partialWindowTitle) { - mChecker.add(entry -> entry.isAppWindowVisible(partialWindowTitle), - "showsAppWindow(" + partialWindowTitle + ")"); - return this; - } - - public WmTraceSubject hidesAppWindow(String partialWindowTitle) { - mChecker.add(entry -> entry.isAppWindowVisible(partialWindowTitle).negate(), - "hidesAppWindow(" + partialWindowTitle + ")"); - return this; - } -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/helpers/AutomationUtils.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/helpers/AutomationUtils.java deleted file mode 100644 index 6821ff02e371..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/helpers/AutomationUtils.java +++ /dev/null @@ -1,263 +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 com.android.server.wm.flicker.helpers; - -import static android.os.SystemClock.sleep; -import static android.system.helpers.OverviewHelper.isRecentsInLauncher; -import static android.view.Surface.ROTATION_0; - -import static com.android.compatibility.common.util.SystemUtil.runShellCommand; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -import android.content.Context; -import android.content.pm.PackageManager; -import android.graphics.Point; -import android.graphics.Rect; -import android.os.RemoteException; -import android.support.test.launcherhelper.LauncherStrategyFactory; -import android.support.test.uiautomator.By; -import android.support.test.uiautomator.BySelector; -import android.support.test.uiautomator.Configurator; -import android.support.test.uiautomator.UiDevice; -import android.support.test.uiautomator.UiObject2; -import android.support.test.uiautomator.Until; -import android.util.Log; -import android.util.Rational; -import android.view.View; -import android.view.ViewConfiguration; - -import androidx.test.InstrumentationRegistry; - -import com.android.server.wm.flicker.WindowUtils; - -/** - * Collection of UI Automation helper functions. - */ -public class AutomationUtils { - private static final String SYSTEMUI_PACKAGE = "com.android.systemui"; - private static final long FIND_TIMEOUT = 10000; - private static final long LONG_PRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout() * 2L; - private static final String TAG = "FLICKER"; - - public static void wakeUpAndGoToHomeScreen() { - UiDevice device = UiDevice.getInstance(InstrumentationRegistry - .getInstrumentation()); - try { - device.wakeUp(); - } catch (RemoteException e) { - throw new RuntimeException(e); - } - device.pressHome(); - } - - /** - * Sets {@link android.app.UiAutomation#waitForIdle(long, long)} global timeout to 0 causing - * the {@link android.app.UiAutomation#waitForIdle(long, long)} function to timeout instantly. - * This removes some delays when using the UIAutomator library required to create fast UI - * transitions. - */ - public static void setFastWait() { - Configurator.getInstance().setWaitForIdleTimeout(0); - } - - /** - * Reverts {@link android.app.UiAutomation#waitForIdle(long, long)} to default behavior. - */ - public static void setDefaultWait() { - Configurator.getInstance().setWaitForIdleTimeout(10000); - } - - public static boolean isQuickstepEnabled(UiDevice device) { - return device.findObject(By.res(SYSTEMUI_PACKAGE, "recent_apps")) == null; - } - - public static void openQuickstep(UiDevice device) { - if (isQuickstepEnabled(device)) { - int height = device.getDisplayHeight(); - UiObject2 navBar = device.findObject(By.res(SYSTEMUI_PACKAGE, "navigation_bar_frame")); - - Rect navBarVisibleBounds; - - // TODO(vishnun) investigate why this object cannot be found. - if (navBar != null) { - navBarVisibleBounds = navBar.getVisibleBounds(); - } else { - Log.e(TAG, "Could not find nav bar, infer location"); - navBarVisibleBounds = WindowUtils.getNavigationBarPosition(ROTATION_0); - } - - // Swipe from nav bar to 2/3rd down the screen. - device.swipe( - navBarVisibleBounds.centerX(), navBarVisibleBounds.centerY(), - navBarVisibleBounds.centerX(), height * 2 / 3, - (navBarVisibleBounds.centerY() - height * 2 / 3) / 100); // 100 px/step - } else { - try { - device.pressRecentApps(); - } catch (RemoteException e) { - throw new RuntimeException(e); - } - } - BySelector RECENTS = By.res(SYSTEMUI_PACKAGE, "recents_view"); - - // use a long timeout to wait until recents populated - if (device.wait( - Until.findObject(isRecentsInLauncher() - ? getLauncherOverviewSelector(device) : RECENTS), - 10000) == null) { - fail("Recents didn't appear"); - } - device.waitForIdle(); - } - - public static void clearRecents(UiDevice device) { - if (isQuickstepEnabled(device)) { - openQuickstep(device); - - for (int i = 0; i < 5; i++) { - device.swipe(device.getDisplayWidth() / 2, - device.getDisplayHeight() / 2, device.getDisplayWidth(), - device.getDisplayHeight() / 2, - 5); - - BySelector clearAllSelector = By.res("com.google.android.apps.nexuslauncher", - "clear_all_button"); - UiObject2 clearAllButton = device.wait(Until.findObject(clearAllSelector), 100); - if (clearAllButton != null) { - clearAllButton.click(); - return; - } - } - } - } - - private static BySelector getLauncherOverviewSelector(UiDevice device) { - return By.res(device.getLauncherPackageName(), "overview_panel"); - } - - private static void longPressRecents(UiDevice device) { - BySelector recentsSelector = By.res(SYSTEMUI_PACKAGE, "recent_apps"); - UiObject2 recentsButton = device.wait(Until.findObject(recentsSelector), FIND_TIMEOUT); - assertNotNull("Unable to find recents button", recentsButton); - recentsButton.click(LONG_PRESS_TIMEOUT); - } - - public static void launchSplitScreen(UiDevice device) { - String mLauncherPackage = LauncherStrategyFactory.getInstance(device) - .getLauncherStrategy().getSupportedLauncherPackage(); - - if (isQuickstepEnabled(device)) { - // Quickstep enabled - openQuickstep(device); - - BySelector overviewIconSelector = By.res(mLauncherPackage, "icon") - .clazz(View.class); - UiObject2 overviewIcon = device.wait(Until.findObject(overviewIconSelector), - FIND_TIMEOUT); - assertNotNull("Unable to find app icon in Overview", overviewIcon); - overviewIcon.click(); - - BySelector splitscreenButtonSelector = By.text("Split screen"); - UiObject2 splitscreenButton = device.wait(Until.findObject(splitscreenButtonSelector), - FIND_TIMEOUT); - assertNotNull("Unable to find Split screen button in Overview", splitscreenButton); - splitscreenButton.click(); - } else { - // Classic long press recents - longPressRecents(device); - } - // Wait for animation to complete. - sleep(2000); - } - - public static void exitSplitScreen(UiDevice device) { - if (isQuickstepEnabled(device)) { - // Quickstep enabled - BySelector dividerSelector = By.res(SYSTEMUI_PACKAGE, "docked_divider_handle"); - UiObject2 divider = device.wait(Until.findObject(dividerSelector), FIND_TIMEOUT); - assertNotNull("Unable to find Split screen divider", divider); - - // Drag the split screen divider to the top of the screen - divider.drag(new Point(device.getDisplayWidth() / 2, 0), 400); - } else { - // Classic long press recents - longPressRecents(device); - } - // Wait for animation to complete. - sleep(2000); - } - - public static void resizeSplitScreen(UiDevice device, Rational windowHeightRatio) { - BySelector dividerSelector = By.res(SYSTEMUI_PACKAGE, "docked_divider_handle"); - UiObject2 divider = device.wait(Until.findObject(dividerSelector), FIND_TIMEOUT); - assertNotNull("Unable to find Split screen divider", divider); - int destHeight = - (int) (WindowUtils.getDisplayBounds().height() * windowHeightRatio.floatValue()); - // Drag the split screen divider to so that the ratio of top window height and bottom - // window height is windowHeightRatio - device.drag(divider.getVisibleBounds().centerX(), divider.getVisibleBounds().centerY(), - device.getDisplayWidth() / 2, destHeight, 10); - //divider.drag(new Point(device.getDisplayWidth() / 2, destHeight), 400) - divider = device.wait(Until.findObject(dividerSelector), FIND_TIMEOUT); - - // Wait for animation to complete. - sleep(2000); - } - - public static void closePipWindow(UiDevice device) { - UiObject2 pipWindow = device.findObject( - By.res(SYSTEMUI_PACKAGE, "background")); - pipWindow.click(); - UiObject2 exitPipObject = device.findObject( - By.res(SYSTEMUI_PACKAGE, "dismiss")); - exitPipObject.click(); - // Wait for animation to complete. - sleep(2000); - } - - public static void expandPipWindow(UiDevice device) { - UiObject2 pipWindow = device.findObject( - By.res(SYSTEMUI_PACKAGE, "background")); - pipWindow.click(); - pipWindow.click(); - } - - public static void stopPackage(Context context, String packageName) { - runShellCommand("am force-stop " + packageName); - int packageUid; - try { - packageUid = context.getPackageManager().getPackageUid(packageName, /* flags= */0); - } catch (PackageManager.NameNotFoundException e) { - return; - } - while (targetPackageIsRunning(packageUid)) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - //ignore - } - } - } - - private static boolean targetPackageIsRunning(int uid) { - final String result = runShellCommand( - String.format("cmd activity get-uid-state %d", uid)); - return !result.contains("(NONEXISTENT)"); - } -}
\ No newline at end of file diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/ITransitionMonitor.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/ITransitionMonitor.java deleted file mode 100644 index 67e0ecc1cde7..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/ITransitionMonitor.java +++ /dev/null @@ -1,63 +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 com.android.server.wm.flicker.monitor; - -import android.os.Environment; - -import java.nio.file.Path; -import java.nio.file.Paths; - -/** - * Collects test artifacts during a UI transition. - */ -public interface ITransitionMonitor { - Path OUTPUT_DIR = Paths.get(Environment.getExternalStorageDirectory().toString(), "flicker"); - - /** - * Starts monitor. - */ - void start(); - - /** - * Stops monitor. - */ - void stop(); - - /** - * Saves any monitor artifacts to file adding {@code testTag} and {@code iteration} - * to the file name. - * - * @param testTag suffix added to artifact name - * @param iteration suffix added to artifact name - * - * @return Path to saved artifact - */ - default Path save(String testTag, int iteration) { - return save(testTag + "_" + iteration); - } - - /** - * Saves any monitor artifacts to file adding {@code testTag} to the file name. - * - * @param testTag suffix added to artifact name - * - * @return Path to saved artifact - */ - default Path save(String testTag) { - throw new UnsupportedOperationException("Save not implemented for this monitor"); - } -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/LayersTraceMonitor.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/LayersTraceMonitor.java deleted file mode 100644 index da75b3e86d6b..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/LayersTraceMonitor.java +++ /dev/null @@ -1,64 +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 com.android.server.wm.flicker.monitor; - -import android.os.RemoteException; -import android.view.IWindowManager; -import android.view.WindowManagerGlobal; - -/** - * Captures Layers trace from SurfaceFlinger. - */ -public class LayersTraceMonitor extends TraceMonitor { - private IWindowManager mWm = WindowManagerGlobal.getWindowManagerService(); - - public LayersTraceMonitor() { - this(OUTPUT_DIR.toString()); - } - - public LayersTraceMonitor(String outputDir) { - super(outputDir, "layers_trace.pb"); - } - - @Override - public void start() { - setEnabled(true); - } - - @Override - public void stop() { - setEnabled(false); - } - - @Override - public boolean isEnabled() throws RemoteException { - try { - return mWm.isLayerTracing(); - } catch (RemoteException e) { - e.printStackTrace(); - } - return false; - } - - private void setEnabled(boolean isEnabled) { - try { - mWm.setLayerTracing(isEnabled); - } catch (RemoteException e) { - e.printStackTrace(); - } - } -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/ScreenRecorder.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/ScreenRecorder.java deleted file mode 100644 index dce1c2739b15..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/ScreenRecorder.java +++ /dev/null @@ -1,80 +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 com.android.server.wm.flicker.monitor; - -import static com.android.compatibility.common.util.SystemUtil.runShellCommand; - -import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; - -import android.util.Log; - -import androidx.annotation.VisibleForTesting; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; - -/** - * Captures screen contents and saves it as a mp4 video file. - */ -public class ScreenRecorder implements ITransitionMonitor { - @VisibleForTesting - public static final Path DEFAULT_OUTPUT_PATH = OUTPUT_DIR.resolve("transition.mp4"); - private static final String TAG = "FLICKER"; - private Thread recorderThread; - - @VisibleForTesting - public static Path getPath(String testTag) { - return OUTPUT_DIR.resolve(testTag + ".mp4"); - } - - @Override - public void start() { - OUTPUT_DIR.toFile().mkdirs(); - String command = "screenrecord " + DEFAULT_OUTPUT_PATH; - recorderThread = new Thread(() -> { - try { - Runtime.getRuntime().exec(command); - } catch (IOException e) { - Log.e(TAG, "Error executing " + command, e); - } - }); - recorderThread.start(); - } - - @Override - public void stop() { - runShellCommand("killall -s 2 screenrecord"); - try { - recorderThread.join(); - } catch (InterruptedException e) { - // ignore - } - } - - @Override - public Path save(String testTag) { - try { - Path targetPath = Files.move(DEFAULT_OUTPUT_PATH, getPath(testTag), - REPLACE_EXISTING); - Log.i(TAG, "Video saved to " + targetPath.toString()); - return targetPath; - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/TraceMonitor.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/TraceMonitor.java deleted file mode 100644 index 1ba36bba92ef..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/TraceMonitor.java +++ /dev/null @@ -1,74 +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 com.android.server.wm.flicker.monitor; - -import static com.android.compatibility.common.util.SystemUtil.runShellCommand; - -import android.os.RemoteException; - -import androidx.annotation.VisibleForTesting; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Locale; - -/** - * Base class for monitors containing common logic to read the trace - * as a byte array and save the trace to another location. - */ -public abstract class TraceMonitor implements ITransitionMonitor { - public static final String TAG = "FLICKER"; - private static final String TRACE_DIR = "/data/misc/wmtrace/"; - - private Path mOutputDir; - public String mTraceFileName; - - public abstract boolean isEnabled() throws RemoteException; - - public TraceMonitor(String outputDir, String traceFileName) { - mOutputDir = Paths.get(outputDir); - mTraceFileName = traceFileName; - } - - /** - * Saves trace file to the external storage directory suffixing the name with the testtag - * and iteration. - * - * Moves the trace file from the default location via a shell command since the test app - * does not have security privileges to access /data/misc/wmtrace. - * - * @param testTag suffix added to trace name used to identify trace - * - * @return Path to saved trace file - */ - @Override - public Path save(String testTag) { - OUTPUT_DIR.toFile().mkdirs(); - Path traceFileCopy = getOutputTraceFilePath(testTag); - - // Read the input stream fully. - String copyCommand = String.format(Locale.getDefault(), "mv %s%s %s", TRACE_DIR, - mTraceFileName, traceFileCopy.toString()); - runShellCommand(copyCommand); - return traceFileCopy; - } - - @VisibleForTesting - public Path getOutputTraceFilePath(String testTag) { - return mOutputDir.resolve(mTraceFileName + "_" + testTag); - } -} diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitor.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitor.java deleted file mode 100644 index 3f86f0d001d7..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitor.java +++ /dev/null @@ -1,100 +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 com.android.server.wm.flicker.monitor; - -import static android.view.FrameStats.UNDEFINED_TIME_NANO; - -import android.app.Instrumentation; -import android.util.Log; -import android.view.FrameStats; - -/** - * Monitors {@link android.view.WindowAnimationFrameStats} to detect janky frames. - * - * Adapted from {@link androidx.test.jank.internal.WindowAnimationFrameStatsMonitorImpl} - * using the same threshold to determine jank. - */ -public class WindowAnimationFrameStatsMonitor implements ITransitionMonitor { - - private static final String TAG = "FLICKER"; - // Maximum normalized error in frame duration before the frame is considered janky - private static final double MAX_ERROR = 0.5f; - // Maximum normalized frame duration before the frame is considered a pause - private static final double PAUSE_THRESHOLD = 15.0f; - private Instrumentation mInstrumentation; - private FrameStats stats; - private int numJankyFrames; - private long mLongestFrameNano = 0L; - - - /** - * Constructs a WindowAnimationFrameStatsMonitor instance. - */ - public WindowAnimationFrameStatsMonitor(Instrumentation instrumentation) { - mInstrumentation = instrumentation; - } - - private void analyze() { - int frameCount = stats.getFrameCount(); - long refreshPeriodNano = stats.getRefreshPeriodNano(); - - // Skip first frame - for (int i = 2; i < frameCount; i++) { - // Handle frames that have not been presented. - if (stats.getFramePresentedTimeNano(i) == UNDEFINED_TIME_NANO) { - // The animation must not have completed. Warn and break out of the loop. - Log.w(TAG, "Skipping fenced frame."); - break; - } - long frameDurationNano = stats.getFramePresentedTimeNano(i) - - stats.getFramePresentedTimeNano(i - 1); - double normalized = (double) frameDurationNano / refreshPeriodNano; - if (normalized < PAUSE_THRESHOLD) { - if (normalized > 1.0f + MAX_ERROR) { - numJankyFrames++; - } - mLongestFrameNano = Math.max(mLongestFrameNano, frameDurationNano); - } - } - } - - @Override - public void start() { - // Clear out any previous data - numJankyFrames = 0; - mLongestFrameNano = 0; - mInstrumentation.getUiAutomation().clearWindowAnimationFrameStats(); - } - - @Override - public void stop() { - stats = mInstrumentation.getUiAutomation().getWindowAnimationFrameStats(); - analyze(); - } - - public boolean jankyFramesDetected() { - return stats.getFrameCount() > 0 && numJankyFrames > 0; - } - - @Override - public String toString() { - return stats.toString() + - " RefreshPeriodNano:" + stats.getRefreshPeriodNano() + - " NumJankyFrames:" + numJankyFrames + - " LongestFrameNano:" + mLongestFrameNano; - } -}
\ No newline at end of file diff --git a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/WindowManagerTraceMonitor.java b/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/WindowManagerTraceMonitor.java deleted file mode 100644 index 11de4aa86343..000000000000 --- a/tests/FlickerTests/lib/src/com/android/server/wm/flicker/monitor/WindowManagerTraceMonitor.java +++ /dev/null @@ -1,59 +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 com.android.server.wm.flicker.monitor; - -import android.os.RemoteException; -import android.view.IWindowManager; -import android.view.WindowManagerGlobal; - -/** - * Captures WindowManager trace from WindowManager. - */ -public class WindowManagerTraceMonitor extends TraceMonitor { - private IWindowManager mWm = WindowManagerGlobal.getWindowManagerService(); - - public WindowManagerTraceMonitor() { - this(OUTPUT_DIR.toString()); - } - - public WindowManagerTraceMonitor(String outputDir) { - super(outputDir, "wm_trace.pb"); - } - - @Override - public void start() { - try { - mWm.startWindowTrace(); - } catch (RemoteException e) { - throw new RuntimeException("Could not start trace", e); - } - } - - @Override - public void stop() { - try { - mWm.stopWindowTrace(); - } catch (RemoteException e) { - throw new RuntimeException("Could not stop trace", e); - } - } - - @Override - public boolean isEnabled() throws RemoteException{ - return mWm.isWindowTraceEnabled(); - } -} diff --git a/tests/FlickerTests/lib/test/Android.bp b/tests/FlickerTests/lib/test/Android.bp deleted file mode 100644 index bfeb75b23469..000000000000 --- a/tests/FlickerTests/lib/test/Android.bp +++ /dev/null @@ -1,33 +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 { - name: "FlickerLibTest", - // sign this with platform cert, so this test is allowed to call private platform apis - certificate: "platform", - platform_apis: true, - test_suites: ["tests"], - srcs: ["src/**/*.java"], - libs: ["android.test.runner"], - static_libs: [ - "androidx.test.rules", - "platform-test-annotations", - "truth-prebuilt", - "platformprotosnano", - "layersprotosnano", - "flickerlib", - ], -} diff --git a/tests/FlickerTests/lib/test/AndroidManifest.xml b/tests/FlickerTests/lib/test/AndroidManifest.xml deleted file mode 100644 index 6451a5710821..000000000000 --- a/tests/FlickerTests/lib/test/AndroidManifest.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - * Copyright 2018 Google Inc. All Rights Reserved. - --> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.server.wm.flicker"> - - <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27"/> - <!-- Read and write traces from external storage --> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> - <!-- Capture screen contents --> - <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> - <!-- Run layers trace --> - <uses-permission android:name="android.permission.HARDWARE_TEST"/> - <application android:label="FlickerLibTest"> - <uses-library android:name="android.test.runner"/> - </application> - - <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.server.wm.flicker" - android:label="WindowManager Flicker Lib Test"> - </instrumentation> - -</manifest>
\ No newline at end of file diff --git a/tests/FlickerTests/lib/test/AndroidTest.xml b/tests/FlickerTests/lib/test/AndroidTest.xml deleted file mode 100644 index e4cc298a2aa8..000000000000 --- a/tests/FlickerTests/lib/test/AndroidTest.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - * Copyright 2018 Google Inc. All Rights Reserved. - --> -<configuration description="Config for WindowManager Flicker Tests"> - <target_preparer class="com.google.android.tradefed.targetprep.GoogleDeviceSetup"> - <!-- keeps the screen on during tests --> - <option name="screen-always-on" value="on" /> - <!-- prevents the phone from restarting --> - <option name="force-skip-system-props" value="true" /> - </target_preparer> - <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> - <option name="cleanup-apks" value="true"/> - <option name="test-file-name" value="FlickerLibTest.apk"/> - </target_preparer> - <test class="com.android.tradefed.testtype.AndroidJUnitTest"> - <option name="package" value="com.android.server.wm.flicker"/> - <option name="hidden-api-checks" value="false" /> - </test> -</configuration> diff --git a/tests/FlickerTests/lib/test/assets/testdata/layers_trace_emptyregion.pb b/tests/FlickerTests/lib/test/assets/testdata/layers_trace_emptyregion.pb Binary files differdeleted file mode 100644 index 98ee6f3ed269..000000000000 --- a/tests/FlickerTests/lib/test/assets/testdata/layers_trace_emptyregion.pb +++ /dev/null diff --git a/tests/FlickerTests/lib/test/assets/testdata/layers_trace_invalid_layer_visibility.pb b/tests/FlickerTests/lib/test/assets/testdata/layers_trace_invalid_layer_visibility.pb Binary files differdeleted file mode 100644 index 20572d79d826..000000000000 --- a/tests/FlickerTests/lib/test/assets/testdata/layers_trace_invalid_layer_visibility.pb +++ /dev/null diff --git a/tests/FlickerTests/lib/test/assets/testdata/layers_trace_orphanlayers.pb b/tests/FlickerTests/lib/test/assets/testdata/layers_trace_orphanlayers.pb Binary files differdeleted file mode 100644 index af4079707c69..000000000000 --- a/tests/FlickerTests/lib/test/assets/testdata/layers_trace_orphanlayers.pb +++ /dev/null diff --git a/tests/FlickerTests/lib/test/assets/testdata/wm_trace_openchrome.pb b/tests/FlickerTests/lib/test/assets/testdata/wm_trace_openchrome.pb Binary files differdeleted file mode 100644 index b3f31706f55c..000000000000 --- a/tests/FlickerTests/lib/test/assets/testdata/wm_trace_openchrome.pb +++ /dev/null diff --git a/tests/FlickerTests/lib/test/assets/testdata/wm_trace_openchrome2.pb b/tests/FlickerTests/lib/test/assets/testdata/wm_trace_openchrome2.pb Binary files differdeleted file mode 100644 index b3b73ce0518a..000000000000 --- a/tests/FlickerTests/lib/test/assets/testdata/wm_trace_openchrome2.pb +++ /dev/null diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/AssertionsCheckerTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/AssertionsCheckerTest.java deleted file mode 100644 index 8e7fe1b4f942..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/AssertionsCheckerTest.java +++ /dev/null @@ -1,181 +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 com.android.server.wm.flicker; - -import static com.google.common.truth.Truth.assertThat; - -import com.android.server.wm.flicker.Assertions.Result; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; - -/** - * Contains {@link AssertionsChecker} tests. - * To run this test: {@code atest FlickerLibTest:AssertionsCheckerTest} - */ -public class AssertionsCheckerTest { - - /** - * Returns a list of SimpleEntry objects with {@code data} and incremental timestamps starting - * at 0. - */ - private static List<SimpleEntry> getTestEntries(int... data) { - List<SimpleEntry> entries = new ArrayList<>(); - for (int i = 0; i < data.length; i++) { - entries.add(new SimpleEntry(i, data[i])); - } - return entries; - } - - @Test - public void canCheckAllEntries() { - AssertionsChecker<SimpleEntry> checker = new AssertionsChecker<>(); - checker.add(SimpleEntry::isData42, "isData42"); - - List<Result> failures = checker.test(getTestEntries(1, 1, 1, 1, 1)); - - assertThat(failures).hasSize(5); - } - - @Test - public void canCheckFirstEntry() { - AssertionsChecker<SimpleEntry> checker = new AssertionsChecker<>(); - checker.checkFirstEntry(); - checker.add(SimpleEntry::isData42, "isData42"); - - List<Result> failures = checker.test(getTestEntries(1, 1, 1, 1, 1)); - - assertThat(failures).hasSize(1); - assertThat(failures.get(0).timestamp).isEqualTo(0); - } - - @Test - public void canCheckLastEntry() { - AssertionsChecker<SimpleEntry> checker = new AssertionsChecker<>(); - checker.checkLastEntry(); - checker.add(SimpleEntry::isData42, "isData42"); - - List<Result> failures = checker.test(getTestEntries(1, 1, 1, 1, 1)); - - assertThat(failures).hasSize(1); - assertThat(failures.get(0).timestamp).isEqualTo(4); - } - - @Test - public void canCheckRangeOfEntries() { - AssertionsChecker<SimpleEntry> checker = new AssertionsChecker<>(); - checker.filterByRange(1, 2); - checker.add(SimpleEntry::isData42, "isData42"); - - List<Result> failures = checker.test(getTestEntries(1, 42, 42, 1, 1)); - - assertThat(failures).hasSize(0); - } - - @Test - public void emptyRangePasses() { - AssertionsChecker<SimpleEntry> checker = new AssertionsChecker<>(); - checker.filterByRange(9, 10); - checker.add(SimpleEntry::isData42, "isData42"); - - List<Result> failures = checker.test(getTestEntries(1, 1, 1, 1, 1)); - - assertThat(failures).isEmpty(); - } - - @Test - public void canCheckChangingAssertions() { - AssertionsChecker<SimpleEntry> checker = new AssertionsChecker<>(); - checker.add(SimpleEntry::isData42, "isData42"); - checker.add(SimpleEntry::isData0, "isData0"); - checker.checkChangingAssertions(); - - List<Result> failures = checker.test(getTestEntries(42, 0, 0, 0, 0)); - - assertThat(failures).isEmpty(); - } - - @Test - public void canCheckChangingAssertions_withNoAssertions() { - AssertionsChecker<SimpleEntry> checker = new AssertionsChecker<>(); - checker.checkChangingAssertions(); - - List<Result> failures = checker.test(getTestEntries(42, 0, 0, 0, 0)); - - assertThat(failures).isEmpty(); - } - - @Test - public void canCheckChangingAssertions_withSingleAssertion() { - AssertionsChecker<SimpleEntry> checker = new AssertionsChecker<>(); - checker.add(SimpleEntry::isData42, "isData42"); - checker.checkChangingAssertions(); - - List<Result> failures = checker.test(getTestEntries(42, 42, 42, 42, 42)); - - assertThat(failures).isEmpty(); - } - - @Test - public void canFailCheckChangingAssertions_ifStartingAssertionFails() { - AssertionsChecker<SimpleEntry> checker = new AssertionsChecker<>(); - checker.add(SimpleEntry::isData42, "isData42"); - checker.add(SimpleEntry::isData0, "isData0"); - checker.checkChangingAssertions(); - - List<Result> failures = checker.test(getTestEntries(0, 0, 0, 0, 0)); - - assertThat(failures).hasSize(1); - } - - @Test - public void canFailCheckChangingAssertions_ifStartingAssertionAlwaysPasses() { - AssertionsChecker<SimpleEntry> checker = new AssertionsChecker<>(); - checker.add(SimpleEntry::isData42, "isData42"); - checker.add(SimpleEntry::isData0, "isData0"); - checker.checkChangingAssertions(); - - List<Result> failures = checker.test(getTestEntries(0, 0, 0, 0, 0)); - - assertThat(failures).hasSize(1); - } - - static class SimpleEntry implements ITraceEntry { - long timestamp; - int data; - - SimpleEntry(long timestamp, int data) { - this.timestamp = timestamp; - this.data = data; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - Result isData42() { - return new Result(this.data == 42, this.timestamp, "is42", ""); - } - - Result isData0() { - return new Result(this.data == 0, this.timestamp, "is42", ""); - } - } -} diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/AssertionsTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/AssertionsTest.java deleted file mode 100644 index 7fd178ca6e51..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/AssertionsTest.java +++ /dev/null @@ -1,60 +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 com.android.server.wm.flicker; - -import static com.google.common.truth.Truth.assertThat; - -import com.android.server.wm.flicker.Assertions.Result; - -import org.junit.Test; - -/** - * Contains {@link Assertions} tests. - * To run this test: {@code atest FlickerLibTest:AssertionsTest} - */ -public class AssertionsTest { - @Test - public void traceEntryAssertionCanNegateResult() { - Assertions.TraceAssertion<Integer> assertNumEquals42 = - getIntegerTraceEntryAssertion(); - - assertThat(assertNumEquals42.apply(1).success).isFalse(); - assertThat(assertNumEquals42.negate().apply(1).success).isTrue(); - - assertThat(assertNumEquals42.apply(42).success).isTrue(); - assertThat(assertNumEquals42.negate().apply(42).success).isFalse(); - } - - @Test - public void resultCanBeNegated() { - String reason = "Everything is fine!"; - Result result = new Result(true, 0, "TestAssert", reason); - Result negatedResult = result.negate(); - assertThat(negatedResult.success).isFalse(); - assertThat(negatedResult.reason).isEqualTo(reason); - assertThat(negatedResult.assertionName).isEqualTo("!TestAssert"); - } - - private Assertions.TraceAssertion<Integer> getIntegerTraceEntryAssertion() { - return (num) -> { - if (num == 42) { - return new Result(true, "Num equals 42"); - } - return new Result(false, "Num doesn't equal 42, actual:" + num); - }; - } -}
\ No newline at end of file diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/LayersTraceSubjectTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/LayersTraceSubjectTest.java deleted file mode 100644 index d06c5d76552b..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/LayersTraceSubjectTest.java +++ /dev/null @@ -1,88 +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 com.android.server.wm.flicker; - -import static com.android.server.wm.flicker.LayersTraceSubject.assertThat; -import static com.android.server.wm.flicker.TestFileUtils.readTestFile; - -import static com.google.common.truth.Truth.assertWithMessage; - -import static org.junit.Assert.fail; - -import android.graphics.Rect; - -import org.junit.Test; - -import java.nio.file.Paths; - -/** - * Contains {@link LayersTraceSubject} tests. - * To run this test: {@code atest FlickerLibTest:LayersTraceSubjectTest} - */ -public class LayersTraceSubjectTest { - private static final Rect displayRect = new Rect(0, 0, 1440, 2880); - - private static LayersTrace readLayerTraceFromFile(String relativePath) { - try { - return LayersTrace.parseFrom(readTestFile(relativePath), Paths.get(relativePath)); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - @Test - public void testCanDetectEmptyRegionFromLayerTrace() { - LayersTrace layersTraceEntries = readLayerTraceFromFile("layers_trace_emptyregion.pb"); - try { - assertThat(layersTraceEntries).coversRegion(displayRect).forAllEntries(); - fail("Assertion passed"); - } catch (AssertionError e) { - assertWithMessage("Contains path to trace") - .that(e.getMessage()).contains("layers_trace_emptyregion.pb"); - assertWithMessage("Contains timestamp") - .that(e.getMessage()).contains("0h38m28s8ms"); - assertWithMessage("Contains assertion function") - .that(e.getMessage()).contains("coversRegion"); - assertWithMessage("Contains debug info") - .that(e.getMessage()).contains("Region to test: " + displayRect); - assertWithMessage("Contains debug info") - .that(e.getMessage()).contains("first empty point: 0, 99"); - } - } - - @Test - public void testCanDetectIncorrectVisibilityFromLayerTrace() { - LayersTrace layersTraceEntries = readLayerTraceFromFile( - "layers_trace_invalid_layer_visibility.pb"); - try { - assertThat(layersTraceEntries).showsLayer("com.android.server.wm.flicker.testapp") - .then().hidesLayer("com.android.server.wm.flicker.testapp").forAllEntries(); - fail("Assertion passed"); - } catch (AssertionError e) { - assertWithMessage("Contains path to trace") - .that(e.getMessage()).contains("layers_trace_invalid_layer_visibility.pb"); - assertWithMessage("Contains timestamp") - .that(e.getMessage()).contains("70h13m14s303ms"); - assertWithMessage("Contains assertion function") - .that(e.getMessage()).contains("!isVisible"); - assertWithMessage("Contains debug info") - .that(e.getMessage()).contains( - "com.android.server.wm.flicker.testapp/com.android.server.wm.flicker.testapp" - + ".SimpleActivity#0 is visible"); - } - } -} diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/LayersTraceTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/LayersTraceTest.java deleted file mode 100644 index 7d77126fd7d4..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/LayersTraceTest.java +++ /dev/null @@ -1,230 +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 com.android.server.wm.flicker; - -import static com.android.server.wm.flicker.TestFileUtils.readTestFile; - -import static com.google.common.truth.Truth.assertThat; -import static com.google.common.truth.Truth.assertWithMessage; - -import static org.junit.Assert.fail; - -import android.content.Context; -import android.graphics.Point; -import android.graphics.Rect; -import android.view.WindowManager; - -import androidx.test.InstrumentationRegistry; - -import org.junit.Test; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * Contains {@link LayersTrace} tests. - * To run this test: {@code atest FlickerLibTest:LayersTraceTest} - */ -public class LayersTraceTest { - private static LayersTrace readLayerTraceFromFile(String relativePath) { - try { - return LayersTrace.parseFrom(readTestFile(relativePath)); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private static Rect getDisplayBounds() { - Point display = new Point(); - WindowManager wm = - (WindowManager) InstrumentationRegistry.getContext().getSystemService( - Context.WINDOW_SERVICE); - wm.getDefaultDisplay().getRealSize(display); - return new Rect(0, 0, display.x, display.y); - } - - @Test - public void canParseAllLayers() { - LayersTrace trace = readLayerTraceFromFile( - "layers_trace_emptyregion.pb"); - assertThat(trace.getEntries()).isNotEmpty(); - assertThat(trace.getEntries().get(0).getTimestamp()).isEqualTo(2307984557311L); - assertThat(trace.getEntries().get(trace.getEntries().size() - 1).getTimestamp()) - .isEqualTo(2308521813510L); - List<LayersTrace.Layer> flattenedLayers = trace.getEntries().get(0).asFlattenedLayers(); - String msg = "Layers:\n" + flattenedLayers.stream().map(layer -> layer.mProto.name) - .collect(Collectors.joining("\n\t")); - assertWithMessage(msg).that(flattenedLayers).hasSize(47); - } - - @Test - public void canParseVisibleLayers() { - LayersTrace trace = readLayerTraceFromFile( - "layers_trace_emptyregion.pb"); - assertThat(trace.getEntries()).isNotEmpty(); - assertThat(trace.getEntries().get(0).getTimestamp()).isEqualTo(2307984557311L); - assertThat(trace.getEntries().get(trace.getEntries().size() - 1).getTimestamp()) - .isEqualTo(2308521813510L); - List<LayersTrace.Layer> flattenedLayers = trace.getEntries().get(0).asFlattenedLayers(); - List<LayersTrace.Layer> visibleLayers = flattenedLayers.stream() - .filter(layer -> layer.isVisible() && !layer.isHiddenByParent()) - .collect(Collectors.toList()); - - String msg = "Visible Layers:\n" + visibleLayers.stream() - .map(layer -> layer.mProto.name) - .collect(Collectors.joining("\n\t")); - - assertWithMessage(msg).that(visibleLayers).hasSize(9); - } - - @Test - public void canParseLayerHierarchy() { - LayersTrace trace = readLayerTraceFromFile( - "layers_trace_emptyregion.pb"); - assertThat(trace.getEntries()).isNotEmpty(); - assertThat(trace.getEntries().get(0).getTimestamp()).isEqualTo(2307984557311L); - assertThat(trace.getEntries().get(trace.getEntries().size() - 1).getTimestamp()) - .isEqualTo(2308521813510L); - List<LayersTrace.Layer> layers = trace.getEntries().get(0).getRootLayers(); - assertThat(layers).hasSize(2); - assertThat(layers.get(0).mChildren).hasSize(layers.get(0).mProto.children.length); - assertThat(layers.get(1).mChildren).hasSize(layers.get(1).mProto.children.length); - } - - // b/76099859 - @Test - public void canDetectOrphanLayers() { - try { - readLayerTraceFromFile( - "layers_trace_orphanlayers.pb"); - fail("Failed to detect orphaned layers."); - } catch (RuntimeException exception) { - assertThat(exception.getMessage()).contains( - "Failed to parse layers trace. Found orphan layers " - + "with parent layer id:1006 : 49"); - } - } - - // b/75276931 - @Test - public void canDetectUncoveredRegion() { - LayersTrace trace = readLayerTraceFromFile( - "layers_trace_emptyregion.pb"); - LayersTrace.Entry entry = trace.getEntry(2308008331271L); - - Assertions.Result result = entry.coversRegion(getDisplayBounds()); - - assertThat(result.failed()).isTrue(); - assertThat(result.reason).contains("Region to test: Rect(0, 0 - 1440, 2880)"); - assertThat(result.reason).contains("first empty point: 0, 99"); - assertThat(result.reason).contains("visible regions:"); - assertWithMessage("Reason contains list of visible regions") - .that(result.reason).contains("StatusBar#0Rect(0, 0 - 1440, 98"); - } - - // Visible region tests - @Test - public void canTestLayerVisibleRegion_layerDoesNotExist() { - LayersTrace trace = readLayerTraceFromFile( - "layers_trace_emptyregion.pb"); - LayersTrace.Entry entry = trace.getEntry(2308008331271L); - - final Rect expectedVisibleRegion = new Rect(0, 0, 1, 1); - Assertions.Result result = entry.hasVisibleRegion("ImaginaryLayer", - expectedVisibleRegion); - - assertThat(result.failed()).isTrue(); - assertThat(result.reason).contains("Could not find ImaginaryLayer"); - } - - @Test - public void canTestLayerVisibleRegion_layerDoesNotHaveExpectedVisibleRegion() { - LayersTrace trace = readLayerTraceFromFile( - "layers_trace_emptyregion.pb"); - LayersTrace.Entry entry = trace.getEntry(2307993020072L); - - final Rect expectedVisibleRegion = new Rect(0, 0, 1, 1); - Assertions.Result result = entry.hasVisibleRegion("NexusLauncherActivity#2", - expectedVisibleRegion); - - assertThat(result.failed()).isTrue(); - assertThat(result.reason).contains( - "Layer com.google.android.apps.nexuslauncher/com.google.android.apps" - + ".nexuslauncher.NexusLauncherActivity#2 is invisible: activeBuffer=null" - + " type != ColorLayer flags=1 (FLAG_HIDDEN set) visible region is empty"); - } - - @Test - public void canTestLayerVisibleRegion_layerIsHiddenByParent() { - LayersTrace trace = readLayerTraceFromFile( - "layers_trace_emptyregion.pb"); - LayersTrace.Entry entry = trace.getEntry(2308455948035L); - - final Rect expectedVisibleRegion = new Rect(0, 0, 1, 1); - Assertions.Result result = entry.hasVisibleRegion( - "SurfaceView - com.android.chrome/com.google.android.apps.chrome.Main", - expectedVisibleRegion); - - assertThat(result.failed()).isTrue(); - assertThat(result.reason).contains( - "Layer SurfaceView - com.android.chrome/com.google.android.apps.chrome.Main#0 is " - + "hidden by parent: com.android.chrome/com.google.android.apps.chrome" - + ".Main#0"); - } - - @Test - public void canTestLayerVisibleRegion_incorrectRegionSize() { - LayersTrace trace = readLayerTraceFromFile( - "layers_trace_emptyregion.pb"); - LayersTrace.Entry entry = trace.getEntry(2308008331271L); - - final Rect expectedVisibleRegion = new Rect(0, 0, 1440, 99); - Assertions.Result result = entry.hasVisibleRegion( - "StatusBar", - expectedVisibleRegion); - - assertThat(result.failed()).isTrue(); - assertThat(result.reason).contains("StatusBar#0 has visible " - + "region:Rect(0, 0 - 1440, 98) expected:Rect(0, 0 - 1440, 99)"); - } - - @Test - public void canTestLayerVisibleRegion() { - LayersTrace trace = readLayerTraceFromFile( - "layers_trace_emptyregion.pb"); - LayersTrace.Entry entry = trace.getEntry(2308008331271L); - - final Rect expectedVisibleRegion = new Rect(0, 0, 1440, 98); - Assertions.Result result = entry.hasVisibleRegion("StatusBar", expectedVisibleRegion); - - assertThat(result.passed()).isTrue(); - } - - @Test - public void canTestLayerVisibleRegion_layerIsNotVisible() { - LayersTrace trace = readLayerTraceFromFile( - "layers_trace_invalid_layer_visibility.pb"); - LayersTrace.Entry entry = trace.getEntry(252794268378458L); - - Assertions.Result result = entry.isVisible("com.android.server.wm.flicker.testapp"); - assertThat(result.failed()).isTrue(); - assertThat(result.reason).contains( - "Layer com.android.server.wm.flicker.testapp/com.android.server.wm.flicker" - + ".testapp.SimpleActivity#0 is invisible: type != ColorLayer visible " - + "region is empty"); - } -} diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/TestFileUtils.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/TestFileUtils.java deleted file mode 100644 index c46175c1a977..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/TestFileUtils.java +++ /dev/null @@ -1,36 +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 com.android.server.wm.flicker; - -import android.content.Context; - -import androidx.test.InstrumentationRegistry; - -import com.google.common.io.ByteStreams; - -import java.io.InputStream; - -/** - * Helper functions for test file resources. - */ -class TestFileUtils { - static byte[] readTestFile(String relativePath) throws Exception { - Context context = InstrumentationRegistry.getContext(); - InputStream in = context.getResources().getAssets().open("testdata/" + relativePath); - return ByteStreams.toByteArray(in); - } -} diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/TransitionRunnerTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/TransitionRunnerTest.java deleted file mode 100644 index 9c5e2059a0e6..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/TransitionRunnerTest.java +++ /dev/null @@ -1,258 +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 com.android.server.wm.flicker; - -import static com.google.common.truth.Truth.assertThat; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; - -import android.os.Environment; - -import com.android.server.wm.flicker.TransitionRunner.TransitionBuilder; -import com.android.server.wm.flicker.TransitionRunner.TransitionResult; -import com.android.server.wm.flicker.monitor.LayersTraceMonitor; -import com.android.server.wm.flicker.monitor.ScreenRecorder; -import com.android.server.wm.flicker.monitor.WindowAnimationFrameStatsMonitor; -import com.android.server.wm.flicker.monitor.WindowManagerTraceMonitor; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InOrder; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import java.io.IOException; -import java.nio.file.Paths; -import java.util.List; - -/** - * Contains {@link TransitionRunner} tests. - * {@code atest FlickerLibTest:TransitionRunnerTest} - */ -public class TransitionRunnerTest { - @Mock - private SimpleUiTransitions mTransitionsMock; - @Mock - private ScreenRecorder mScreenRecorderMock; - @Mock - private WindowManagerTraceMonitor mWindowManagerTraceMonitorMock; - @Mock - private LayersTraceMonitor mLayersTraceMonitorMock; - @Mock - private WindowAnimationFrameStatsMonitor mWindowAnimationFrameStatsMonitor; - @InjectMocks - private TransitionBuilder mTransitionBuilder; - - @Before - public void init() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void transitionsRunInOrder() { - TransitionRunner.newBuilder() - .runBeforeAll(mTransitionsMock::turnOnDevice) - .runBefore(mTransitionsMock::openApp) - .run(mTransitionsMock::performMagic) - .runAfter(mTransitionsMock::closeApp) - .runAfterAll(mTransitionsMock::cleanUpTracks) - .skipLayersTrace() - .skipWindowManagerTrace() - .build() - .run(); - - InOrder orderVerifier = inOrder(mTransitionsMock); - orderVerifier.verify(mTransitionsMock).turnOnDevice(); - orderVerifier.verify(mTransitionsMock).openApp(); - orderVerifier.verify(mTransitionsMock).performMagic(); - orderVerifier.verify(mTransitionsMock).closeApp(); - orderVerifier.verify(mTransitionsMock).cleanUpTracks(); - } - - @Test - public void canCombineTransitions() { - TransitionRunner.newBuilder() - .runBeforeAll(mTransitionsMock::turnOnDevice) - .runBeforeAll(mTransitionsMock::turnOnDevice) - .runBefore(mTransitionsMock::openApp) - .runBefore(mTransitionsMock::openApp) - .run(mTransitionsMock::performMagic) - .run(mTransitionsMock::performMagic) - .runAfter(mTransitionsMock::closeApp) - .runAfter(mTransitionsMock::closeApp) - .runAfterAll(mTransitionsMock::cleanUpTracks) - .runAfterAll(mTransitionsMock::cleanUpTracks) - .skipLayersTrace() - .skipWindowManagerTrace() - .build() - .run(); - - final int wantedNumberOfInvocations = 2; - verify(mTransitionsMock, times(wantedNumberOfInvocations)).turnOnDevice(); - verify(mTransitionsMock, times(wantedNumberOfInvocations)).openApp(); - verify(mTransitionsMock, times(wantedNumberOfInvocations)).performMagic(); - verify(mTransitionsMock, times(wantedNumberOfInvocations)).closeApp(); - verify(mTransitionsMock, times(wantedNumberOfInvocations)).cleanUpTracks(); - } - - @Test - public void emptyTransitionPasses() { - List<TransitionResult> results = TransitionRunner.newBuilder() - .skipLayersTrace() - .skipWindowManagerTrace() - .build() - .run() - .getResults(); - assertThat(results).hasSize(1); - assertThat(results.get(0).layersTraceExists()).isFalse(); - assertThat(results.get(0).windowManagerTraceExists()).isFalse(); - assertThat(results.get(0).screenCaptureVideoExists()).isFalse(); - } - - @Test - public void canRepeatTransitions() { - final int wantedNumberOfInvocations = 10; - TransitionRunner.newBuilder() - .runBeforeAll(mTransitionsMock::turnOnDevice) - .runBefore(mTransitionsMock::openApp) - .run(mTransitionsMock::performMagic) - .runAfter(mTransitionsMock::closeApp) - .runAfterAll(mTransitionsMock::cleanUpTracks) - .repeat(wantedNumberOfInvocations) - .skipLayersTrace() - .skipWindowManagerTrace() - .build() - .run(); - verify(mTransitionsMock).turnOnDevice(); - verify(mTransitionsMock, times(wantedNumberOfInvocations)).openApp(); - verify(mTransitionsMock, times(wantedNumberOfInvocations)).performMagic(); - verify(mTransitionsMock, times(wantedNumberOfInvocations)).closeApp(); - verify(mTransitionsMock).cleanUpTracks(); - } - - private void emptyTask() { - - } - - @Test - public void canCaptureWindowManagerTrace() { - mTransitionBuilder - .run(this::emptyTask) - .includeJankyRuns() - .skipLayersTrace() - .withTag("mCaptureWmTraceTransitionRunner") - .build().run(); - InOrder orderVerifier = inOrder(mWindowManagerTraceMonitorMock); - orderVerifier.verify(mWindowManagerTraceMonitorMock).start(); - orderVerifier.verify(mWindowManagerTraceMonitorMock).stop(); - orderVerifier.verify(mWindowManagerTraceMonitorMock) - .save("mCaptureWmTraceTransitionRunner", 0); - verifyNoMoreInteractions(mWindowManagerTraceMonitorMock); - } - - @Test - public void canCaptureLayersTrace() { - mTransitionBuilder - .run(this::emptyTask) - .includeJankyRuns() - .skipWindowManagerTrace() - .withTag("mCaptureLayersTraceTransitionRunner") - .build().run(); - InOrder orderVerifier = inOrder(mLayersTraceMonitorMock); - orderVerifier.verify(mLayersTraceMonitorMock).start(); - orderVerifier.verify(mLayersTraceMonitorMock).stop(); - orderVerifier.verify(mLayersTraceMonitorMock) - .save("mCaptureLayersTraceTransitionRunner", 0); - verifyNoMoreInteractions(mLayersTraceMonitorMock); - } - - @Test - public void canRecordEachRun() throws IOException { - mTransitionBuilder - .run(this::emptyTask) - .withTag("mRecordEachRun") - .recordEachRun() - .includeJankyRuns() - .skipLayersTrace() - .skipWindowManagerTrace() - .repeat(2) - .build().run(); - InOrder orderVerifier = inOrder(mScreenRecorderMock); - orderVerifier.verify(mScreenRecorderMock).start(); - orderVerifier.verify(mScreenRecorderMock).stop(); - orderVerifier.verify(mScreenRecorderMock).save("mRecordEachRun", 0); - orderVerifier.verify(mScreenRecorderMock).start(); - orderVerifier.verify(mScreenRecorderMock).stop(); - orderVerifier.verify(mScreenRecorderMock).save("mRecordEachRun", 1); - verifyNoMoreInteractions(mScreenRecorderMock); - } - - @Test - public void canRecordAllRuns() throws IOException { - doReturn(Paths.get(Environment.getExternalStorageDirectory().getAbsolutePath(), - "mRecordAllRuns.mp4")).when(mScreenRecorderMock).save("mRecordAllRuns"); - mTransitionBuilder - .run(this::emptyTask) - .recordAllRuns() - .includeJankyRuns() - .skipLayersTrace() - .skipWindowManagerTrace() - .withTag("mRecordAllRuns") - .repeat(2) - .build().run(); - InOrder orderVerifier = inOrder(mScreenRecorderMock); - orderVerifier.verify(mScreenRecorderMock).start(); - orderVerifier.verify(mScreenRecorderMock).stop(); - orderVerifier.verify(mScreenRecorderMock).save("mRecordAllRuns"); - verifyNoMoreInteractions(mScreenRecorderMock); - } - - @Test - public void canSkipJankyRuns() { - doReturn(false).doReturn(true).doReturn(false) - .when(mWindowAnimationFrameStatsMonitor).jankyFramesDetected(); - List<TransitionResult> results = mTransitionBuilder - .run(this::emptyTask) - .skipLayersTrace() - .skipWindowManagerTrace() - .repeat(3) - .build().run().getResults(); - assertThat(results).hasSize(2); - } - - public static class SimpleUiTransitions { - public void turnOnDevice() { - } - - public void openApp() { - } - - public void performMagic() { - } - - public void closeApp() { - } - - public void cleanUpTracks() { - } - } -} diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/WindowManagerTraceTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/WindowManagerTraceTest.java deleted file mode 100644 index 49278718932c..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/WindowManagerTraceTest.java +++ /dev/null @@ -1,108 +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 com.android.server.wm.flicker; - -import static com.android.server.wm.flicker.TestFileUtils.readTestFile; - -import static com.google.common.truth.Truth.assertThat; - -import com.android.server.wm.flicker.Assertions.Result; - -import org.junit.Before; -import org.junit.Test; - -/** - * Contains {@link WindowManagerTrace} tests. - * To run this test: {@code atest FlickerLibTest:WindowManagerTraceTest} - */ -public class WindowManagerTraceTest { - private WindowManagerTrace mTrace; - - private static WindowManagerTrace readWindowManagerTraceFromFile(String relativePath) { - try { - return WindowManagerTrace.parseFrom(readTestFile(relativePath)); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - @Before - public void setup() { - mTrace = readWindowManagerTraceFromFile("wm_trace_openchrome.pb"); - } - - @Test - public void canParseAllEntries() { - assertThat(mTrace.getEntries().get(0).getTimestamp()).isEqualTo(241777211939236L); - assertThat(mTrace.getEntries().get(mTrace.getEntries().size() - 1).getTimestamp()).isEqualTo - (241779809471942L); - } - - @Test - public void canDetectAboveAppWindowVisibility() { - WindowManagerTrace.Entry entry = mTrace.getEntry(241777211939236L); - Result result = entry.isAboveAppWindowVisible("NavigationBar"); - assertThat(result.passed()).isTrue(); - } - - @Test - public void canDetectBelowAppWindowVisibility() { - WindowManagerTrace.Entry entry = mTrace.getEntry(241777211939236L); - Result result = entry.isBelowAppWindowVisible("wallpaper"); - assertThat(result.passed()).isTrue(); - } - - @Test - public void canDetectAppWindowVisibility() { - WindowManagerTrace.Entry entry = mTrace.getEntry(241777211939236L); - Result result = entry.isAppWindowVisible("com.google.android.apps.nexuslauncher"); - assertThat(result.passed()).isTrue(); - } - - @Test - public void canFailWithReasonForVisibilityChecks_windowNotFound() { - WindowManagerTrace.Entry entry = mTrace.getEntry(241777211939236L); - Result result = entry.isAboveAppWindowVisible("ImaginaryWindow"); - assertThat(result.failed()).isTrue(); - assertThat(result.reason).contains("ImaginaryWindow cannot be found"); - } - - @Test - public void canFailWithReasonForVisibilityChecks_windowNotVisible() { - WindowManagerTrace.Entry entry = mTrace.getEntry(241777211939236L); - Result result = entry.isAboveAppWindowVisible("AssistPreviewPanel"); - assertThat(result.failed()).isTrue(); - assertThat(result.reason).contains("AssistPreviewPanel is invisible"); - } - - @Test - public void canDetectAppZOrder() { - WindowManagerTrace.Entry entry = mTrace.getEntry(241778130296410L); - Result result = entry.isVisibleAppWindowOnTop("com.google.android.apps.chrome"); - assertThat(result.passed()).isTrue(); - } - - @Test - public void canFailWithReasonForZOrderChecks_windowNotOnTop() { - WindowManagerTrace.Entry entry = mTrace.getEntry(241778130296410L); - Result result = entry.isVisibleAppWindowOnTop("com.google.android.apps.nexuslauncher"); - assertThat(result.failed()).isTrue(); - assertThat(result.reason).contains("wanted=com.google.android.apps.nexuslauncher"); - assertThat(result.reason).contains("found=com.android.chrome/" - + "com.google.android.apps.chrome.Main"); - } -} diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/WmTraceSubjectTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/WmTraceSubjectTest.java deleted file mode 100644 index d547a188a663..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/WmTraceSubjectTest.java +++ /dev/null @@ -1,49 +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 com.android.server.wm.flicker; - -import static com.android.server.wm.flicker.TestFileUtils.readTestFile; -import static com.android.server.wm.flicker.WmTraceSubject.assertThat; - -import org.junit.Test; - -/** - * Contains {@link WmTraceSubject} tests. - * To run this test: {@code atest FlickerLibTest:WmTraceSubjectTest} - */ -public class WmTraceSubjectTest { - private static WindowManagerTrace readWmTraceFromFile(String relativePath) { - try { - return WindowManagerTrace.parseFrom(readTestFile(relativePath)); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - @Test - public void testCanTransitionInAppWindow() { - WindowManagerTrace trace = readWmTraceFromFile("wm_trace_openchrome2.pb"); - - assertThat(trace).showsAppWindowOnTop("com.google.android.apps.nexuslauncher/" - + ".NexusLauncherActivity").forRange(174684850717208L, 174685957511016L); - assertThat(trace).showsAppWindowOnTop( - "com.google.android.apps.nexuslauncher/.NexusLauncherActivity") - .then() - .showsAppWindowOnTop("com.android.chrome") - .forAllEntries(); - } -} diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/LayersTraceMonitorTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/LayersTraceMonitorTest.java deleted file mode 100644 index dbd6761a05b0..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/LayersTraceMonitorTest.java +++ /dev/null @@ -1,78 +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 com.android.server.wm.flicker.monitor; - -import static android.surfaceflinger.nano.Layerstrace.LayersTraceFileProto.MAGIC_NUMBER_H; -import static android.surfaceflinger.nano.Layerstrace.LayersTraceFileProto.MAGIC_NUMBER_L; - -import static com.google.common.truth.Truth.assertThat; - -import android.surfaceflinger.nano.Layerstrace.LayersTraceFileProto; - -import com.google.common.io.Files; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.File; - -/** - * Contains {@link LayersTraceMonitor} tests. - * To run this test: {@code atest FlickerLibTest:LayersTraceMonitorTest} - */ -public class LayersTraceMonitorTest { - private LayersTraceMonitor mLayersTraceMonitor; - - @Before - public void setup() { - mLayersTraceMonitor = new LayersTraceMonitor(); - } - - @After - public void teardown() { - mLayersTraceMonitor.stop(); - mLayersTraceMonitor.getOutputTraceFilePath("captureLayersTrace").toFile().delete(); - } - - @Test - public void canStartLayersTrace() throws Exception { - mLayersTraceMonitor.start(); - assertThat(mLayersTraceMonitor.isEnabled()).isTrue(); - } - - @Test - public void canStopLayersTrace() throws Exception { - mLayersTraceMonitor.start(); - assertThat(mLayersTraceMonitor.isEnabled()).isTrue(); - mLayersTraceMonitor.stop(); - assertThat(mLayersTraceMonitor.isEnabled()).isFalse(); - } - - @Test - public void captureLayersTrace() throws Exception { - mLayersTraceMonitor.start(); - mLayersTraceMonitor.stop(); - File testFile = mLayersTraceMonitor.save("captureLayersTrace").toFile(); - assertThat(testFile.exists()).isTrue(); - byte[] trace = Files.toByteArray(testFile); - assertThat(trace.length).isGreaterThan(0); - LayersTraceFileProto mLayerTraceFileProto = LayersTraceFileProto.parseFrom(trace); - assertThat(mLayerTraceFileProto.magicNumber).isEqualTo( - (long) MAGIC_NUMBER_H << 32 | MAGIC_NUMBER_L); - } -} diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/ScreenRecorderTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/ScreenRecorderTest.java deleted file mode 100644 index e73eecc348f0..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/ScreenRecorderTest.java +++ /dev/null @@ -1,70 +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 com.android.server.wm.flicker.monitor; - -import static android.os.SystemClock.sleep; - -import static com.android.server.wm.flicker.monitor.ScreenRecorder.DEFAULT_OUTPUT_PATH; -import static com.android.server.wm.flicker.monitor.ScreenRecorder.getPath; - -import static com.google.common.truth.Truth.assertThat; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.File; -import java.io.IOException; - -/** - * Contains {@link ScreenRecorder} tests. - * To run this test: {@code atest FlickerLibTest:ScreenRecorderTest} - */ -public class ScreenRecorderTest { - private static final String TEST_VIDEO_FILENAME = "test.mp4"; - private ScreenRecorder mScreenRecorder; - - @Before - public void setup() { - mScreenRecorder = new ScreenRecorder(); - } - - @After - public void teardown() { - DEFAULT_OUTPUT_PATH.toFile().delete(); - getPath(TEST_VIDEO_FILENAME).toFile().delete(); - } - - @Test - public void videoIsRecorded() { - mScreenRecorder.start(); - sleep(100); - mScreenRecorder.stop(); - File file = DEFAULT_OUTPUT_PATH.toFile(); - assertThat(file.exists()).isTrue(); - } - - @Test - public void videoCanBeSaved() { - mScreenRecorder.start(); - sleep(100); - mScreenRecorder.stop(); - mScreenRecorder.save(TEST_VIDEO_FILENAME); - File file = getPath(TEST_VIDEO_FILENAME).toFile(); - assertThat(file.exists()).isTrue(); - } -} diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitorTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitorTest.java deleted file mode 100644 index f31238477e95..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/WindowAnimationFrameStatsMonitorTest.java +++ /dev/null @@ -1,50 +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 com.android.server.wm.flicker.monitor; - -import static com.android.server.wm.flicker.helpers.AutomationUtils.wakeUpAndGoToHomeScreen; - -import androidx.test.InstrumentationRegistry; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; - -/** - * Contains {@link WindowAnimationFrameStatsMonitor} tests. - * To run this test: {@code atest FlickerLibTest:WindowAnimationFrameStatsMonitorTest} - */ -public class WindowAnimationFrameStatsMonitorTest { - private WindowAnimationFrameStatsMonitor mWindowAnimationFrameStatsMonitor; - - @Before - public void setup() { - mWindowAnimationFrameStatsMonitor = new WindowAnimationFrameStatsMonitor( - InstrumentationRegistry.getInstrumentation()); - wakeUpAndGoToHomeScreen(); - } - - // TODO(vishnun) - @Ignore("Disabled until app-helper libraries are available.") - @Test - public void captureWindowAnimationFrameStats() throws Exception { - mWindowAnimationFrameStatsMonitor.start(); - //AppHelperWrapper.getInstance().getHelper(CHROME).open(); - //AppHelperWrapper.getInstance().getHelper(CHROME).exit(); - mWindowAnimationFrameStatsMonitor.stop(); - } -} diff --git a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/WindowManagerTraceMonitorTest.java b/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/WindowManagerTraceMonitorTest.java deleted file mode 100644 index 56284d7d516a..000000000000 --- a/tests/FlickerTests/lib/test/src/com/android/server/wm/flicker/monitor/WindowManagerTraceMonitorTest.java +++ /dev/null @@ -1,79 +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 com.android.server.wm.flicker.monitor; - -import static com.android.server.wm.nano.WindowManagerTraceFileProto.MAGIC_NUMBER_H; -import static com.android.server.wm.nano.WindowManagerTraceFileProto.MAGIC_NUMBER_L; - -import static com.google.common.truth.Truth.assertThat; - -import com.android.server.wm.nano.WindowManagerTraceFileProto; - -import com.google.common.io.Files; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.File; - -/** - * Contains {@link WindowManagerTraceMonitor} tests. - * To run this test: {@code atest FlickerLibTest:WindowManagerTraceMonitorTest} - */ -public class WindowManagerTraceMonitorTest { - private WindowManagerTraceMonitor mWindowManagerTraceMonitor; - - @Before - public void setup() { - mWindowManagerTraceMonitor = new WindowManagerTraceMonitor(); - } - - @After - public void teardown() { - mWindowManagerTraceMonitor.stop(); - mWindowManagerTraceMonitor.getOutputTraceFilePath("captureWindowTrace").toFile().delete(); - } - - @Test - public void canStartWindowTrace() throws Exception { - mWindowManagerTraceMonitor.start(); - assertThat(mWindowManagerTraceMonitor.isEnabled()).isTrue(); - } - - @Test - public void canStopWindowTrace() throws Exception { - mWindowManagerTraceMonitor.start(); - assertThat(mWindowManagerTraceMonitor.isEnabled()).isTrue(); - mWindowManagerTraceMonitor.stop(); - assertThat(mWindowManagerTraceMonitor.isEnabled()).isFalse(); - } - - @Test - public void captureWindowTrace() throws Exception { - mWindowManagerTraceMonitor.start(); - mWindowManagerTraceMonitor.stop(); - File testFile = mWindowManagerTraceMonitor.save("captureWindowTrace").toFile(); - assertThat(testFile.exists()).isTrue(); - byte[] trace = Files.toByteArray(testFile); - assertThat(trace.length).isGreaterThan(0); - WindowManagerTraceFileProto mWindowTraceFileProto = WindowManagerTraceFileProto.parseFrom( - trace); - assertThat(mWindowTraceFileProto.magicNumber).isEqualTo( - (long) MAGIC_NUMBER_H << 32 | MAGIC_NUMBER_L); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java index b6860cbd8d96..aa591d919cbe 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java @@ -29,11 +29,15 @@ import android.util.Log; import android.view.Surface; import androidx.test.InstrumentationRegistry; +import androidx.test.filters.FlakyTest; import androidx.test.filters.LargeTest; import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @@ -44,18 +48,19 @@ import java.util.Collection; * Cycle through supported app rotations. * To run this test: {@code atest FlickerTest:ChangeAppRotationTest} */ -@RunWith(Parameterized.class) @LargeTest +@RunWith(Parameterized.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class ChangeAppRotationTest extends FlickerTestBase { - private int beginRotation; - private int endRotation; + private int mBeginRotation; + private int mEndRotation; public ChangeAppRotationTest(String beginRotationName, String endRotationName, int beginRotation, int endRotation) { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); - this.beginRotation = beginRotation; - this.endRotation = endRotation; + this.mBeginRotation = beginRotation; + this.mEndRotation = endRotation; } @Parameters(name = "{0}-{1}") @@ -77,15 +82,19 @@ public class ChangeAppRotationTest extends FlickerTestBase { @Before public void runTransition() { super.runTransition( - changeAppRotation(testApp, uiDevice, beginRotation, endRotation).build()); + changeAppRotation(mTestApp, mUiDevice, mBeginRotation, mEndRotation).build()); } + @FlakyTest(bugId = 140855415) + @Ignore("Waiting bug feedback") @Test public void checkVisibility_navBarWindowIsAlwaysVisible() { checkResults(result -> assertThat(result) .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); } + @FlakyTest(bugId = 140855415) + @Ignore("Waiting bug feedback") @Test public void checkVisibility_statusBarWindowIsAlwaysVisible() { checkResults(result -> assertThat(result) @@ -94,8 +103,8 @@ public class ChangeAppRotationTest extends FlickerTestBase { @Test public void checkPosition_navBarLayerRotatesAndScales() { - Rect startingPos = getNavigationBarPosition(beginRotation); - Rect endingPos = getNavigationBarPosition(endRotation); + Rect startingPos = getNavigationBarPosition(mBeginRotation); + Rect endingPos = getNavigationBarPosition(mEndRotation); checkResults(result -> { LayersTraceSubject.assertThat(result) .hasVisibleRegion(NAVIGATION_BAR_WINDOW_TITLE, startingPos) @@ -108,22 +117,22 @@ public class ChangeAppRotationTest extends FlickerTestBase { @Test public void checkPosition_appLayerRotates() { - Rect startingPos = getAppPosition(beginRotation); - Rect endingPos = getAppPosition(endRotation); + Rect startingPos = getAppPosition(mBeginRotation); + Rect endingPos = getAppPosition(mEndRotation); Log.e(TAG, "startingPos=" + startingPos + " endingPos=" + endingPos); checkResults(result -> { LayersTraceSubject.assertThat(result) - .hasVisibleRegion(testApp.getPackage(), startingPos).inTheBeginning(); + .hasVisibleRegion(mTestApp.getPackage(), startingPos).inTheBeginning(); LayersTraceSubject.assertThat(result) - .hasVisibleRegion(testApp.getPackage(), endingPos).atTheEnd(); + .hasVisibleRegion(mTestApp.getPackage(), endingPos).atTheEnd(); } ); } @Test public void checkPosition_statusBarLayerScales() { - Rect startingPos = getStatusBarPosition(beginRotation); - Rect endingPos = getStatusBarPosition(endRotation); + Rect startingPos = getStatusBarPosition(mBeginRotation); + Rect endingPos = getStatusBarPosition(mEndRotation); checkResults(result -> { LayersTraceSubject.assertThat(result) .hasVisibleRegion(STATUS_BAR_WINDOW_TITLE, startingPos) @@ -134,12 +143,16 @@ public class ChangeAppRotationTest extends FlickerTestBase { ); } + @FlakyTest(bugId = 140855415) + @Ignore("Waiting bug feedback") @Test public void checkVisibility_navBarLayerIsAlwaysVisible() { checkResults(result -> LayersTraceSubject.assertThat(result) .showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); } + @FlakyTest(bugId = 140855415) + @Ignore("Waiting bug feedback") @Test public void checkVisibility_statusBarLayerIsAlwaysVisible() { checkResults(result -> LayersTraceSubject.assertThat(result) diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java index 6590b86f1499..9deb97726542 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java @@ -26,8 +26,10 @@ import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; +import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * Test IME window closing back to app window transitions. @@ -35,6 +37,7 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class CloseImeWindowToAppTest extends FlickerTestBase { private static final String IME_WINDOW_TITLE = "InputMethod"; @@ -44,7 +47,7 @@ public class CloseImeWindowToAppTest extends FlickerTestBase { @Before public void runTransition() { - super.runTransition(editTextLoseFocusToApp(uiDevice) + super.runTransition(editTextLoseFocusToApp(mUiDevice) .includeJankyRuns().build()); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java index 4771b02000c0..cce5a2a7cc0d 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java @@ -26,8 +26,10 @@ import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; +import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * Test IME window closing to home transitions. @@ -35,6 +37,7 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class CloseImeWindowToHomeTest extends FlickerTestBase { private static final String IME_WINDOW_TITLE = "InputMethod"; @@ -44,7 +47,7 @@ public class CloseImeWindowToHomeTest extends FlickerTestBase { @Before public void runTransition() { - super.runTransition(editTextLoseFocusToHome(uiDevice) + super.runTransition(editTextLoseFocusToHome(mUiDevice) .includeJankyRuns().build()); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java index 5cf2c1cd6827..1d44ea490f25 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java @@ -67,7 +67,7 @@ class CommonTransitions { device.setOrientationNatural(); } // Wait for animation to complete - sleep(3000); + sleep(1000); } catch (RemoteException e) { throw new RuntimeException(e); } @@ -216,10 +216,10 @@ class CommonTransitions { static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, IAppHelper testAppBottom, UiDevice device, Rational startRatio, Rational stopRatio) { - String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_" + - testAppBottom.getLauncherName() + "_" + - startRatio.toString().replace("/", ":") + "_to_" + - stopRatio.toString().replace("/", ":"); + String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_" + + testAppBottom.getLauncherName() + "_" + + startRatio.toString().replace("/", ":") + "_to_" + + stopRatio.toString().replace("/", ":"); return TransitionRunner.newBuilder() .withTag(testTag) .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) @@ -231,7 +231,7 @@ class CommonTransitions { .runBefore(() -> launchSplitScreen(device)) .runBefore(() -> { UiObject2 snapshot = device.findObject( - By.res("com.google.android.apps.nexuslauncher", "snapshot")); + By.res(device.getLauncherPackageName(), "snapshot")); snapshot.click(); }) .runBefore(() -> AutomationUtils.resizeSplitScreen(device, startRatio)) @@ -316,4 +316,4 @@ class CommonTransitions { .runAfterAll(testApp::exit) .repeat(ITERATIONS); } -}
\ No newline at end of file +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java index 61cca0d6b53f..9836655bc013 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java @@ -22,17 +22,22 @@ import android.util.Rational; import android.view.Surface; import androidx.test.InstrumentationRegistry; +import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; +import org.junit.FixMethodOrder; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * Tests to help debug individual transitions, capture video recordings and create test cases. */ +@LargeTest @Ignore("Used for debugging transitions used in FlickerTests.") @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class DebugTest { private IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java index 8c9d6b4dc7a0..6e8e0c3c76c5 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java @@ -16,20 +16,23 @@ package com.android.server.wm.flicker; +import static androidx.test.InstrumentationRegistry.getInstrumentation; + import static com.android.server.wm.flicker.helpers.AutomationUtils.setDefaultWait; import static com.google.common.truth.Truth.assertWithMessage; +import android.os.Bundle; import android.platform.helpers.IAppHelper; +import android.support.test.InstrumentationRegistry; import android.support.test.uiautomator.UiDevice; import android.util.Log; -import androidx.test.InstrumentationRegistry; - import com.android.server.wm.flicker.TransitionRunner.TransitionResult; import org.junit.After; import org.junit.AfterClass; +import org.junit.Before; import java.util.HashMap; import java.util.List; @@ -51,10 +54,16 @@ public class FlickerTestBase { static final String DOCKED_STACK_DIVIDER = "DockedStackDivider"; private static HashMap<String, List<TransitionResult>> transitionResults = new HashMap<>(); - IAppHelper testApp; - UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); - private List<TransitionResult> results; - private TransitionResult lastResult = null; + IAppHelper mTestApp; + UiDevice mUiDevice; + private List<TransitionResult> mResults; + private TransitionResult mLastResult = null; + + @Before + public void setUp() { + InstrumentationRegistry.registerInstance(getInstrumentation(), new Bundle()); + mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); + } /** * Teardown any system settings and clean up test artifacts from the file system. @@ -91,14 +100,14 @@ public class FlickerTestBase { */ void runTransition(TransitionRunner transition) { if (transitionResults.containsKey(transition.getTestTag())) { - results = transitionResults.get(transition.getTestTag()); + mResults = transitionResults.get(transition.getTestTag()); return; } - results = transition.run().getResults(); + mResults = transition.run().getResults(); /* Fail if we don't have any results due to jank */ assertWithMessage("No results to test because all transition runs were invalid because " - + "of Jank").that(results).isNotEmpty(); - transitionResults.put(transition.getTestTag(), results); + + "of Jank").that(mResults).isNotEmpty(); + transitionResults.put(transition.getTestTag(), mResults); } /** @@ -106,11 +115,11 @@ public class FlickerTestBase { */ void checkResults(Consumer<TransitionResult> assertion) { - for (TransitionResult result : results) { - lastResult = result; + for (TransitionResult result : mResults) { + mLastResult = result; assertion.accept(result); } - lastResult = null; + mLastResult = null; } /** @@ -119,8 +128,8 @@ public class FlickerTestBase { */ @After public void markArtifactsForSaving() { - if (lastResult != null) { - lastResult.flagForSaving(); + if (mLastResult != null) { + mLastResult.flagForSaving(); } } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java index 7818c4e4ba50..8d99054d907e 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java @@ -21,12 +21,16 @@ import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; import static com.android.server.wm.flicker.WmTraceSubject.assertThat; import androidx.test.InstrumentationRegistry; +import androidx.test.filters.FlakyTest; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * Test cold launch app from launcher. @@ -34,16 +38,17 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class OpenAppColdTest extends FlickerTestBase { public OpenAppColdTest() { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - super.runTransition(getOpenAppCold(testApp, uiDevice).build()); + super.runTransition(getOpenAppCold(mTestApp, mUiDevice).build()); } @Test @@ -61,9 +66,9 @@ public class OpenAppColdTest extends FlickerTestBase { @Test public void checkVisibility_wallpaperWindowBecomesInvisible() { checkResults(result -> assertThat(result) - .showsBelowAppWindow("wallpaper") + .showsBelowAppWindow("Wallpaper") .then() - .hidesBelowAppWindow("wallpaper") + .hidesBelowAppWindow("Wallpaper") .forAllEntries()); } @@ -71,13 +76,15 @@ public class OpenAppColdTest extends FlickerTestBase { public void checkZOrder_appWindowReplacesLauncherAsTopWindow() { checkResults(result -> assertThat(result) .showsAppWindowOnTop( - "com.google.android.apps.nexuslauncher/.NexusLauncherActivity") + "com.android.launcher3/.Launcher") .then() - .showsAppWindowOnTop(testApp.getPackage()) + .showsAppWindowOnTop(mTestApp.getPackage()) .forAllEntries()); } @Test + @FlakyTest(bugId = 141235985) + @Ignore("Waiting bug feedback") public void checkCoveredRegion_noUncoveredRegions() { checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion( getDisplayBounds()).forAllEntries()); @@ -98,9 +105,9 @@ public class OpenAppColdTest extends FlickerTestBase { @Test public void checkVisibility_wallpaperLayerBecomesInvisible() { checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer("wallpaper") + .showsLayer("Wallpaper") .then() - .hidesLayer("wallpaper") + .hidesLayer("Wallpaper") .forAllEntries()); } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java index 63018ec1d9e7..f8b7938901a8 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java @@ -24,8 +24,10 @@ import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; +import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * Test open app to split screen. @@ -33,16 +35,17 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class OpenAppToSplitScreenTest extends FlickerTestBase { public OpenAppToSplitScreenTest() { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - super.runTransition(appToSplitScreen(testApp, uiDevice).includeJankyRuns().build()); + super.runTransition(appToSplitScreen(mTestApp, mUiDevice).includeJankyRuns().build()); } @Test diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java index 1aba93056c89..e8702c2dfa9f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java @@ -21,12 +21,16 @@ import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; import static com.android.server.wm.flicker.WmTraceSubject.assertThat; import androidx.test.InstrumentationRegistry; +import androidx.test.filters.FlakyTest; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * Test warm launch app. @@ -34,16 +38,17 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class OpenAppWarmTest extends FlickerTestBase { public OpenAppWarmTest() { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - super.runTransition(openAppWarm(testApp, uiDevice).build()); + super.runTransition(openAppWarm(mTestApp, mUiDevice).includeJankyRuns().build()); } @Test @@ -61,9 +66,9 @@ public class OpenAppWarmTest extends FlickerTestBase { @Test public void checkVisibility_wallpaperBecomesInvisible() { checkResults(result -> assertThat(result) - .showsBelowAppWindow("wallpaper") + .showsBelowAppWindow("Wallpaper") .then() - .hidesBelowAppWindow("wallpaper") + .hidesBelowAppWindow("Wallpaper") .forAllEntries()); } @@ -71,12 +76,14 @@ public class OpenAppWarmTest extends FlickerTestBase { public void checkZOrder_appWindowReplacesLauncherAsTopWindow() { checkResults(result -> assertThat(result) .showsAppWindowOnTop( - "com.google.android.apps.nexuslauncher/.NexusLauncherActivity") + "com.android.launcher3/.Launcher") .then() - .showsAppWindowOnTop(testApp.getPackage()) + .showsAppWindowOnTop(mTestApp.getPackage()) .forAllEntries()); } + @FlakyTest(bugId = 141235985) + @Ignore("Waiting bug feedback") @Test public void checkCoveredRegion_noUncoveredRegions() { checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion( @@ -98,9 +105,9 @@ public class OpenAppWarmTest extends FlickerTestBase { @Test public void checkVisibility_wallpaperLayerBecomesInvisible() { checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer("wallpaper") + .showsLayer("Wallpaper") .then() - .hidesLayer("wallpaper") + .hidesLayer("Wallpaper") .forAllEntries()); } } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java index a81fa8e6d123..9f5cfcedd38f 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java @@ -23,8 +23,10 @@ import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; +import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * Test IME window opening transitions. @@ -32,13 +34,14 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class OpenImeWindowTest extends FlickerTestBase { private static final String IME_WINDOW_TITLE = "InputMethod"; @Before public void runTransition() { - super.runTransition(editTextSetFocus(uiDevice) + super.runTransition(editTextSetFocus(mUiDevice) .includeJankyRuns().build()); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java index 50dba81e53b7..1031baf7ec04 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java @@ -28,12 +28,16 @@ import android.platform.helpers.IAppHelper; import android.util.Rational; import androidx.test.InstrumentationRegistry; +import androidx.test.filters.FlakyTest; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * Test split screen resizing window transitions. @@ -41,10 +45,13 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@FlakyTest(bugId = 140856143) +@Ignore("Waiting bug feedback") public class ResizeSplitScreenTest extends FlickerTestBase { public ResizeSplitScreenTest() { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @@ -53,7 +60,7 @@ public class ResizeSplitScreenTest extends FlickerTestBase { IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry .getInstrumentation(), "com.android.server.wm.flicker.testapp", "ImeApp"); - super.runTransition(resizeSplitScreen(testApp, bottomApp, uiDevice, new Rational(1, 3), + super.runTransition(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, new Rational(1, 3), new Rational(2, 3)).includeJankyRuns().build()); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java index 117ac5a8fadf..ae55a75d7e67 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java @@ -33,8 +33,10 @@ import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; import org.junit.Before; +import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @@ -47,6 +49,7 @@ import java.util.Collection; */ @LargeTest @RunWith(Parameterized.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class SeamlessAppRotationTest extends FlickerTestBase { private int mBeginRotation; private int mEndRotation; @@ -105,7 +108,7 @@ public class SeamlessAppRotationTest extends FlickerTestBase { super.runTransition( changeAppRotation(mIntent, intentId, InstrumentationRegistry.getContext(), - uiDevice, mBeginRotation, mEndRotation).repeat(5).build()); + mUiDevice, mBeginRotation, mEndRotation).repeat(5).build()); } @Test diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java index 1d30df9750b2..85a14941a7fd 100644 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java @@ -25,8 +25,11 @@ import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * Test open app to split screen. @@ -34,16 +37,19 @@ import org.junit.runner.RunWith; */ @LargeTest @RunWith(AndroidJUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@FlakyTest(bugId = 140856143) +@Ignore("Waiting bug feedback") public class SplitScreenToLauncherTest extends FlickerTestBase { public SplitScreenToLauncherTest() { - this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), + this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), "com.android.server.wm.flicker.testapp", "SimpleApp"); } @Before public void runTransition() { - super.runTransition(splitScreenToLauncher(testApp, uiDevice).includeJankyRuns().build()); + super.runTransition(splitScreenToLauncher(mTestApp, mUiDevice).includeJankyRuns().build()); } @Test @@ -62,13 +68,12 @@ public class SplitScreenToLauncherTest extends FlickerTestBase { .forAllEntries()); } - @FlakyTest(bugId = 79686616) @Test public void checkVisibility_appLayerBecomesInVisible() { checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(testApp.getPackage()) + .showsLayer(mTestApp.getPackage()) .then() - .hidesLayer(testApp.getPackage()) + .hidesLayer(mTestApp.getPackage()) .forAllEntries()); } diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/StandardAppHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/StandardAppHelper.java deleted file mode 100644 index 79a0220e0e87..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/StandardAppHelper.java +++ /dev/null @@ -1,59 +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 com.android.server.wm.flicker; - -import android.app.Instrumentation; -import android.platform.helpers.AbstractStandardAppHelper; - -/** - * Class to take advantage of {@code IAppHelper} interface so the same test can be run against - * first party and third party apps. - */ -public class StandardAppHelper extends AbstractStandardAppHelper { - private final String mPackageName; - private final String mLauncherName; - - public StandardAppHelper(Instrumentation instr, String packageName, String launcherName) { - super(instr); - mPackageName = packageName; - mLauncherName = launcherName; - } - - /** - * {@inheritDoc} - */ - @Override - public String getPackage() { - return mPackageName; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLauncherName() { - return mLauncherName; - } - - /** - * {@inheritDoc} - */ - @Override - public void dismissInitialDialogs() { - - } -} diff --git a/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/SeamlessRotationActivity.java b/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/SeamlessRotationActivity.java index 3a0c1c9382fe..5cf81cb90fbc 100644 --- a/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/SeamlessRotationActivity.java +++ b/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/SeamlessRotationActivity.java @@ -17,7 +17,6 @@ package com.android.server.wm.flicker.testapp; import static android.os.SystemClock.sleep; -import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; import static com.android.server.wm.flicker.testapp.ActivityOptions.EXTRA_STARVE_UI_THREAD; @@ -39,8 +38,8 @@ public class SeamlessRotationActivity extends Activity { super.onCreate(savedInstanceState); enableSeamlessRotation(); setContentView(R.layout.activity_simple); - boolean starveUiThread = getIntent().getExtras() != null && - getIntent().getExtras().getBoolean(EXTRA_STARVE_UI_THREAD); + boolean starveUiThread = getIntent().getExtras() != null + && getIntent().getExtras().getBoolean(EXTRA_STARVE_UI_THREAD); if (starveUiThread) { starveUiThread(); } diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java index f2f258a737e3..9e21db76be84 100644 --- a/tests/net/java/com/android/server/ConnectivityServiceTest.java +++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java @@ -504,6 +504,8 @@ public class ConnectivityServiceTest { // Waits for the NetworkAgent to be registered, which includes the creation of the // NetworkMonitor. waitForIdle(TIMEOUT_MS); + HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); + HandlerUtilsKt.waitForIdle(ConnectivityThread.get(), TIMEOUT_MS); } @Override @@ -4315,16 +4317,16 @@ public class ConnectivityServiceTest { assertFalse(mCm.isNetworkSupported(TYPE_NONE)); assertThrows(IllegalArgumentException.class, - () -> { mCm.networkCapabilitiesForType(TYPE_NONE); }); + () -> mCm.networkCapabilitiesForType(TYPE_NONE)); Class<UnsupportedOperationException> unsupported = UnsupportedOperationException.class; - assertThrows(unsupported, () -> { mCm.startUsingNetworkFeature(TYPE_WIFI, ""); }); - assertThrows(unsupported, () -> { mCm.stopUsingNetworkFeature(TYPE_WIFI, ""); }); + assertThrows(unsupported, () -> mCm.startUsingNetworkFeature(TYPE_WIFI, "")); + assertThrows(unsupported, () -> mCm.stopUsingNetworkFeature(TYPE_WIFI, "")); // TODO: let test context have configuration application target sdk version // and test that pre-M requesting for TYPE_NONE sends back APN_REQUEST_FAILED - assertThrows(unsupported, () -> { mCm.startUsingNetworkFeature(TYPE_NONE, ""); }); - assertThrows(unsupported, () -> { mCm.stopUsingNetworkFeature(TYPE_NONE, ""); }); - assertThrows(unsupported, () -> { mCm.requestRouteToHostAddress(TYPE_NONE, null); }); + assertThrows(unsupported, () -> mCm.startUsingNetworkFeature(TYPE_NONE, "")); + assertThrows(unsupported, () -> mCm.stopUsingNetworkFeature(TYPE_NONE, "")); + assertThrows(unsupported, () -> mCm.requestRouteToHostAddress(TYPE_NONE, null)); } @Test |