diff options
165 files changed, 1332 insertions, 937 deletions
diff --git a/Android.bp b/Android.bp index ee593aac39ad..383f58f31cf0 100644 --- a/Android.bp +++ b/Android.bp @@ -550,6 +550,7 @@ java_defaults {          "telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl",          "telephony/java/com/android/internal/telephony/ISms.aidl",          "telephony/java/com/android/internal/telephony/ISub.aidl", +        "telephony/java/com/android/internal/telephony/IAns.aidl",          "telephony/java/com/android/internal/telephony/ITelephony.aidl",          "telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl",          "telephony/java/com/android/internal/telephony/IWapPushManager.aidl", @@ -600,6 +601,7 @@ java_defaults {          ":netd_aidl",          ":vold_aidl",          ":installd_aidl", +        ":dumpstate_aidl",          "lowpan/java/android/net/lowpan/ILowpanEnergyScanCallback.aidl",          "lowpan/java/android/net/lowpan/ILowpanNetScanCallback.aidl", @@ -646,6 +648,7 @@ java_defaults {          include_dirs: [              "system/update_engine/binder_bindings",              "frameworks/native/aidl/binder", +            "frameworks/native/cmds/dumpstate/binder",              "frameworks/av/camera/aidl",              "frameworks/av/media/libaudioclient/aidl",              "frameworks/native/aidl/gui", @@ -668,9 +671,6 @@ java_defaults {      no_framework_libs: true,      libs: [ -        "conscrypt", -        "okhttp", -        "bouncycastle",          "ext",      ], @@ -691,6 +691,7 @@ java_defaults {          "android.hardware.radio-V1.0-java",          "android.hardware.radio-V1.3-java",          "android.hardware.usb.gadget-V1.0-java", +        "netd_aidl_interface-java",      ],      // Loaded with System.loadLibrary by android.view.textclassifier @@ -1075,14 +1076,13 @@ framework_docs_args = "-android -manifest $(location core/res/AndroidManifest.xm       "-federationapi SupportLib $(location current/support-api.txt) "  framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " + +     "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +       "-overview $(location core/java/overview.html) " +       // Federate Support Library references against local API file.       "-federate SupportLib https://developer.android.com " +       "-federationapi SupportLib $(location current/support-api.txt) "  framework_docs_only_libs = [ -    "conscrypt", -    "bouncycastle",      "voip-common",      "android.test.mock",      "android-support-annotations", @@ -1162,7 +1162,8 @@ stubs_defaults {  doc_defaults {      name: "framework-docs-default", -    libs: framework_docs_only_libs, +    libs: framework_docs_only_libs + +         ["stub-annotations"],      html_dirs: [          "docs/html",      ], @@ -1559,7 +1560,6 @@ filegroup {          "core/java/org/apache/http/params/CoreConnectionPNames.java",          "core/java/org/apache/http/params/HttpConnectionParams.java",          "core/java/org/apache/http/params/HttpParams.java", -        "core/java/android/net/http/HttpResponseCache.java",          "core/java/android/net/http/SslCertificate.java",          "core/java/android/net/http/SslError.java",          "core/java/com/android/internal/util/HexDump.java", diff --git a/CleanSpec.mk b/CleanSpec.mk index 2247e43758d7..6deda0caa9aa 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -247,6 +247,7 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/statsd  $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.mediadrm.signer.jar)  $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.location.provider.jar)  $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.future.usb.accessory.jar) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.media.remotedisplay.jar)  # ******************************************************************  # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER  # ****************************************************************** diff --git a/api/current.txt b/api/current.txt index bafd4711cca3..aca5e5194290 100755 --- a/api/current.txt +++ b/api/current.txt @@ -42637,6 +42637,7 @@ package android.telephony {      method public static int getDefaultSubscriptionId();      method public static int getDefaultVoiceSubscriptionId();      method public static int[] getSubscriptionIds(int); +    method public java.util.List<android.telephony.SubscriptionInfo> getOpportunisticSubscriptions(int);      method public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int);      method public boolean isActiveSubscriptionId(int);      method public boolean isNetworkRoaming(int); diff --git a/api/system-current.txt b/api/system-current.txt index 89ac7210de46..57f9efab3f5b 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -120,6 +120,7 @@ package android {      field public static final java.lang.String MOUNT_FORMAT_FILESYSTEMS = "android.permission.MOUNT_FORMAT_FILESYSTEMS";      field public static final java.lang.String MOUNT_UNMOUNT_FILESYSTEMS = "android.permission.MOUNT_UNMOUNT_FILESYSTEMS";      field public static final java.lang.String MOVE_PACKAGE = "android.permission.MOVE_PACKAGE"; +    field public static final java.lang.String NETWORK_SETUP_WIZARD = "android.permission.NETWORK_SETUP_WIZARD";      field public static final java.lang.String NOTIFICATION_DURING_SETUP = "android.permission.NOTIFICATION_DURING_SETUP";      field public static final java.lang.String NOTIFY_TV_INPUTS = "android.permission.NOTIFY_TV_INPUTS";      field public static final java.lang.String OBSERVE_APP_USAGE = "android.permission.OBSERVE_APP_USAGE"; @@ -3074,6 +3075,7 @@ package android.net {    public class ConnectivityManager {      method public java.lang.String getCaptivePortalServerUrl();      method public boolean isTetheringSupported(); +    method public void setAirplaneMode(boolean);      method public void startTethering(int, boolean, android.net.ConnectivityManager.OnStartTetheringCallback);      method public void startTethering(int, boolean, android.net.ConnectivityManager.OnStartTetheringCallback, android.os.Handler);      method public void stopTethering(int); @@ -5095,6 +5097,7 @@ package android.telephony {      method public int getRejectCause();      method public int getTransportType();      method public boolean isEmergencyEnabled(); +    method public boolean isRoaming();      method public void writeToParcel(android.os.Parcel, int);      field public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationState> CREATOR;      field public static final int DOMAIN_CS = 1; // 0x1 @@ -5182,6 +5185,8 @@ package android.telephony {      method public void setSubscriptionPlans(int, java.util.List<android.telephony.SubscriptionPlan>);      field public static final java.lang.String ACTION_MANAGE_SUBSCRIPTION_PLANS = "android.telephony.action.MANAGE_SUBSCRIPTION_PLANS";      field public static final java.lang.String ACTION_REFRESH_SUBSCRIPTION_PLANS = "android.telephony.action.REFRESH_SUBSCRIPTION_PLANS"; +    field public static final android.net.Uri ENHANCED_4G_ENABLED_CONTENT_URI; +    field public static final android.net.Uri WFC_ENABLED_CONTENT_URI;    }    public final class SubscriptionPlan implements android.os.Parcelable { diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index c4824c084370..e12b665d1505 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -120,6 +120,8 @@ message Atom {          AppCrashOccurred app_crash_occurred = 78;          ANROccurred anr_occurred = 79;          WTFOccurred wtf_occurred = 80; +        PhoneServiceStateChanged phone_service_state_changed = 94; +        PhoneStateChanged phone_state_changed = 95;          LowMemReported low_mem_reported = 81; @@ -1137,6 +1139,33 @@ message PhoneSignalStrengthChanged {      optional android.telephony.SignalStrengthEnum signal_strength = 1;  } + +/** + * Logs when the phone state, sim state or signal strength changes + * + * Logged from: + *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java + */ +message PhoneServiceStateChanged { +    optional android.telephony.ServiceStateEnum state = 1; +    optional android.telephony.SimStateEnum sim_state = 2; +    optional android.telephony.SignalStrengthEnum signal_strength = 3; +} + +/** + * Logs when the phone becomes on or off. + * + * Logged from: + *   frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java + */ +message PhoneStateChanged { +    enum State { +        OFF = 0; +        ON = 1; +    } +    optional State state = 1; +} +  /**   * Logs that a setting was updated.   * Logged from: diff --git a/cmds/statsd/src/hash.cpp b/cmds/statsd/src/hash.cpp index c501c9f818b9..543a748adedb 100644 --- a/cmds/statsd/src/hash.cpp +++ b/cmds/statsd/src/hash.cpp @@ -16,6 +16,10 @@  #include "hash.h" +#ifndef FALLTHROUGH_INTENDED +#define FALLTHROUGH_INTENDED [[fallthrough]] +#endif +  namespace android {  namespace os {  namespace statsd { @@ -67,8 +71,10 @@ uint32_t Hash32(const char *data, size_t n, uint32_t seed) {    switch (n) {      case 3:        h ^= ByteAs32(data[2]) << 16; +      FALLTHROUGH_INTENDED;      case 2:        h ^= ByteAs32(data[1]) << 8; +      FALLTHROUGH_INTENDED;      case 1:        h ^= ByteAs32(data[0]);        h *= m; @@ -104,16 +110,22 @@ uint64_t Hash64(const char* data, size_t n, uint64_t seed) {    switch (n) {      case 7:        h ^= ByteAs64(data[6]) << 48; +      FALLTHROUGH_INTENDED;      case 6:        h ^= ByteAs64(data[5]) << 40; +      FALLTHROUGH_INTENDED;      case 5:        h ^= ByteAs64(data[4]) << 32; +      FALLTHROUGH_INTENDED;      case 4:        h ^= ByteAs64(data[3]) << 24; +      FALLTHROUGH_INTENDED;      case 3:        h ^= ByteAs64(data[2]) << 16; +      FALLTHROUGH_INTENDED;      case 2:        h ^= ByteAs64(data[1]) << 8; +      FALLTHROUGH_INTENDED;      case 1:        h ^= ByteAs64(data[0]);        h *= m; diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt index fbf5b5288928..dc399881a34b 100644 --- a/config/hiddenapi-light-greylist.txt +++ b/config/hiddenapi-light-greylist.txt @@ -573,7 +573,6 @@ Landroid/net/IConnectivityManager;->getTetherableWifiRegexs()[Ljava/lang/String;  Landroid/net/IConnectivityManager;->getTetheredIfaces()[Ljava/lang/String;  Landroid/net/IConnectivityManager;->getTetheringErroredIfaces()[Ljava/lang/String;  Landroid/net/IConnectivityManager;->reportInetCondition(II)V -Landroid/net/IConnectivityManager;->setAirplaneMode(Z)V  Landroid/net/IConnectivityManager;->startLegacyVpn(Lcom/android/internal/net/VpnProfile;)V  Landroid/net/INetworkManagementEventObserver$Stub;-><init>()V  Landroid/net/INetworkPolicyListener$Stub;-><init>()V @@ -2288,6 +2287,7 @@ Lcom/android/org/conscrypt/OpenSSLKey;->fromPrivateKey(Ljava/security/PrivateKey  Lcom/android/org/conscrypt/OpenSSLKey;->getNativeRef()Lcom/android/org/conscrypt/NativeRef$EVP_PKEY;  Lcom/android/org/conscrypt/OpenSSLKey;->getPublicKey()Ljava/security/PublicKey;  Lcom/android/org/conscrypt/OpenSSLProvider;-><init>()V +Lcom/android/org/conscrypt/OpenSSLRandom;-><init>()V  Lcom/android/org/conscrypt/OpenSSLSocketImpl;->getAlpnSelectedProtocol()[B  Lcom/android/org/conscrypt/OpenSSLSocketImpl;->getChannelId()[B  Lcom/android/org/conscrypt/OpenSSLSocketImpl;->getHostname()Ljava/lang/String; @@ -2860,6 +2860,7 @@ Ljavax/net/ssl/SSLServerSocketFactory;->defaultServerSocketFactory:Ljavax/net/ss  Ljavax/net/ssl/SSLSocketFactory;->createSocket(Ljava/net/Socket;Ljava/io/InputStream;Z)Ljava/net/Socket;  Ljavax/net/ssl/SSLSocketFactory;->defaultSocketFactory:Ljavax/net/ssl/SSLSocketFactory;  Llibcore/icu/ICU;->addLikelySubtags(Ljava/util/Locale;)Ljava/util/Locale; +Llibcore/io/Libcore;->os:Llibcore/io/Os;  Llibcore/io/Memory;->peekByte(J)B  Llibcore/io/Memory;->peekByteArray(J[BII)V  Llibcore/io/Memory;->peekInt(JZ)I diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 73e98cd99f8f..d9e6fa203823 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -107,20 +107,6 @@ public final class BluetoothDevice implements Parcelable {              "android.bluetooth.device.action.FOUND";      /** -     * Broadcast Action: Remote device disappeared. -     * <p>Sent when a remote device that was found in the last discovery is not -     * found in the current discovery. -     * <p>Always contains the extra field {@link #EXTRA_DEVICE}. -     * <p>Requires {@link android.Manifest.permission#BLUETOOTH} to receive. -     * -     * @hide -     */ -    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) -    @UnsupportedAppUsage -    public static final String ACTION_DISAPPEARED = -            "android.bluetooth.device.action.DISAPPEARED"; - -    /**       * Broadcast Action: Bluetooth class of a remote device has changed.       * <p>Always contains the extra fields {@link #EXTRA_DEVICE} and {@link       * #EXTRA_CLASS}. diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 0fc55b4a7f09..2b6077040f13 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -3946,6 +3946,12 @@ public class Intent implements Parcelable, Cloneable {      public static final String EXTRA_LTE_EARFCN_RSRP_BOOST = "LteEarfcnRsrpBoost";      /** +     * An parcelable extra used with {@link #ACTION_SERVICE_STATE} representing the service state. +     * @hide +     */ +    public static final String EXTRA_SERVICE_STATE = "android.intent.extra.SERVICE_STATE"; + +    /**       * The name of the extra used to define the text to be processed, as a       * CharSequence. Note that this may be a styled CharSequence, so you must use       * {@link Bundle#getCharSequence(String) Bundle.getCharSequence()} to retrieve it. diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 5cbd18538fd1..35db667922ca 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -5132,6 +5132,7 @@ public abstract class PackageManager {       * @param packageName The name of the package to query       * @throws IllegalArgumentException if the given package name is not installed       */ +    @Nullable      public abstract String getInstallerPackageName(String packageName);      /** diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index caa99d5cb2a8..12c2149284b5 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -2082,7 +2082,7 @@ public abstract class CameraMetadata<TKey> {      /**       * <p>Optimized for dim settings where the main light source -     * is a flame.</p> +     * is a candle.</p>       * @see CaptureRequest#CONTROL_SCENE_MODE       */      public static final int CONTROL_SCENE_MODE_CANDLELIGHT = 15; diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 8333b817add0..1fbfa40d5d64 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -83,6 +83,7 @@ import java.util.Map;  @SystemService(Context.CONNECTIVITY_SERVICE)  public class ConnectivityManager {      private static final String TAG = "ConnectivityManager"; +    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);      /**       * A change in network connectivity has occurred. A default connection has either @@ -2493,6 +2494,7 @@ public class ConnectivityManager {       * {@hide}       */      public void reportInetCondition(int networkType, int percentage) { +        printStackTrace();          try {              mService.reportInetCondition(networkType, percentage);          } catch (RemoteException e) { @@ -2513,6 +2515,7 @@ public class ConnectivityManager {       */      @Deprecated      public void reportBadNetwork(Network network) { +        printStackTrace();          try {              // One of these will be ignored because it matches system's current state.              // The other will trigger the necessary reevaluation. @@ -2535,6 +2538,7 @@ public class ConnectivityManager {       *                        Internet using {@code network} or {@code false} if not.       */      public void reportNetworkConnectivity(Network network, boolean hasConnectivity) { +        printStackTrace();          try {              mService.reportNetworkConnectivity(network, hasConnectivity);          } catch (RemoteException e) { @@ -2727,8 +2731,11 @@ public class ConnectivityManager {       *       * @hide       */ -    @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL) -    @UnsupportedAppUsage +    @RequiresPermission(anyOf = { +            android.Manifest.permission.NETWORK_SETTINGS, +            android.Manifest.permission.NETWORK_SETUP_WIZARD, +            android.Manifest.permission.NETWORK_STACK}) +    @SystemApi      public void setAirplaneMode(boolean enable) {          try {              mService.setAirplaneMode(enable); @@ -3073,6 +3080,7 @@ public class ConnectivityManager {      private NetworkRequest sendRequestForNetwork(NetworkCapabilities need, NetworkCallback callback,              int timeoutMs, int action, int legacyType, CallbackHandler handler) { +        printStackTrace();          checkCallbackNotNull(callback);          Preconditions.checkArgument(action == REQUEST || need != null, "null NetworkCapabilities");          final NetworkRequest request; @@ -3332,6 +3340,7 @@ public class ConnectivityManager {       *         {@link NetworkCapabilities#NET_CAPABILITY_CAPTIVE_PORTAL}.       */      public void requestNetwork(NetworkRequest request, PendingIntent operation) { +        printStackTrace();          checkPendingIntentNotNull(operation);          try {              mService.pendingRequestForNetwork(request.networkCapabilities, operation); @@ -3355,6 +3364,7 @@ public class ConnectivityManager {       *                  corresponding NetworkRequest you'd like to remove. Cannot be null.       */      public void releaseNetworkRequest(PendingIntent operation) { +        printStackTrace();          checkPendingIntentNotNull(operation);          try {              mService.releasePendingNetworkRequest(operation); @@ -3439,6 +3449,7 @@ public class ConnectivityManager {       */      @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)      public void registerNetworkCallback(NetworkRequest request, PendingIntent operation) { +        printStackTrace();          checkPendingIntentNotNull(operation);          try {              mService.pendingListenForNetwork(request.networkCapabilities, operation); @@ -3520,6 +3531,7 @@ public class ConnectivityManager {       * @param networkCallback The {@link NetworkCallback} used when making the request.       */      public void unregisterNetworkCallback(NetworkCallback networkCallback) { +        printStackTrace();          checkCallbackNotNull(networkCallback);          final List<NetworkRequest> reqs = new ArrayList<>();          // Find all requests associated to this callback and stop callback triggers immediately. @@ -3948,4 +3960,19 @@ public class ConnectivityManager {              throw e.rethrowFromSystemServer();          }      } + +    private void printStackTrace() { +        if (DEBUG) { +            final StackTraceElement[] callStack = Thread.currentThread().getStackTrace(); +            final StringBuffer sb = new StringBuffer(); +            for (int i = 3; i < callStack.length; i++) { +                final String stackTrace = callStack[i].toString(); +                if (stackTrace == null || stackTrace.contains("android.os")) { +                    break; +                } +                sb.append(" [").append(stackTrace).append("]"); +            } +            Log.d(TAG, "StackLog:" + sb.toString()); +        } +    }  } diff --git a/core/java/android/os/DumpstateOptions.java b/core/java/android/os/DumpstateOptions.java new file mode 100644 index 000000000000..53037b2499cd --- /dev/null +++ b/core/java/android/os/DumpstateOptions.java @@ -0,0 +1,57 @@ +/* + * 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.os; + +/** + * Options passed to dumpstate service. + * + * @hide + */ +public final class DumpstateOptions implements Parcelable { +    // If true the caller can get callbacks with per-section +    // progress details. +    private final boolean mGetSectionDetails; +    // Name of the caller. +    private final String mName; + +    public DumpstateOptions(Parcel in) { +        mGetSectionDetails = in.readBoolean(); +        mName = in.readString(); +    } + +    @Override +    public int describeContents() { +        return 0; +    } + +    @Override +     public void writeToParcel(Parcel out, int flags) { +        out.writeBoolean(mGetSectionDetails); +        out.writeString(mName); +    } + +    public static final Parcelable.Creator<DumpstateOptions> CREATOR = +            new Parcelable.Creator<DumpstateOptions>() { +        public DumpstateOptions createFromParcel(Parcel in) { +            return new DumpstateOptions(in); +        } + +        public DumpstateOptions[] newArray(int size) { +            return new DumpstateOptions[size]; +        } +    }; +} diff --git a/core/java/android/os/Message.java b/core/java/android/os/Message.java index b303e10fa64b..c3f60a332a2b 100644 --- a/core/java/android/os/Message.java +++ b/core/java/android/os/Message.java @@ -366,7 +366,7 @@ public final class Message implements Parcelable {       * the <em>target</em> {@link Handler} that is receiving this Message to       * dispatch it.  If       * not set, the message will be dispatched to the receiving Handler's -     * {@link Handler#handleMessage(Message Handler.handleMessage())}. +     * {@link Handler#handleMessage(Message)}.       */      public Runnable getCallback() {          return callback; diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 10c32a3b7a36..486c836279ce 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -5369,6 +5369,7 @@ public class BatteryStatsImpl extends BatteryStats {                  if (DEBUG_HISTORY) Slog.v(TAG, "Phone started scanning to: "                          + Integer.toHexString(mHistoryCur.states));                  mPhoneSignalScanningTimer.startRunningLocked(elapsedRealtime); +                StatsLog.write(StatsLog.PHONE_SERVICE_STATE_CHANGED, state, simState, strengthBin);              }          } @@ -5380,6 +5381,7 @@ public class BatteryStatsImpl extends BatteryStats {                          + Integer.toHexString(mHistoryCur.states));                  newHistory = true;                  mPhoneSignalScanningTimer.stopRunningLocked(elapsedRealtime); +                StatsLog.write(StatsLog.PHONE_SERVICE_STATE_CHANGED, state, simState, strengthBin);              }          } diff --git a/core/java/com/android/internal/os/ProcessCpuTracker.java b/core/java/com/android/internal/os/ProcessCpuTracker.java index bf31c7d8ad85..1ee4269d974b 100644 --- a/core/java/com/android/internal/os/ProcessCpuTracker.java +++ b/core/java/com/android/internal/os/ProcessCpuTracker.java @@ -29,7 +29,6 @@ import android.util.Slog;  import com.android.internal.util.FastPrintWriter;  import libcore.io.IoUtils; -import libcore.io.Libcore;  import java.io.File;  import java.io.FileInputStream; diff --git a/core/java/com/android/internal/widget/AlertDialogLayout.java b/core/java/com/android/internal/widget/AlertDialogLayout.java index 9bf094891f3b..7a0174946671 100644 --- a/core/java/com/android/internal/widget/AlertDialogLayout.java +++ b/core/java/com/android/internal/widget/AlertDialogLayout.java @@ -18,6 +18,7 @@ package com.android.internal.widget;  import android.annotation.AttrRes;  import android.annotation.Nullable; +import android.annotation.UnsupportedAppUsage;  import android.annotation.StyleRes;  import android.content.Context;  import android.graphics.drawable.Drawable; @@ -50,6 +51,7 @@ public class AlertDialogLayout extends LinearLayout {          super(context);      } +    @UnsupportedAppUsage      public AlertDialogLayout(@Nullable Context context, @Nullable AttributeSet attrs) {          super(context, attrs);      } diff --git a/core/java/com/android/internal/widget/ButtonBarLayout.java b/core/java/com/android/internal/widget/ButtonBarLayout.java index ab8be33599fa..0ca67438c5c3 100644 --- a/core/java/com/android/internal/widget/ButtonBarLayout.java +++ b/core/java/com/android/internal/widget/ButtonBarLayout.java @@ -16,6 +16,7 @@  package com.android.internal.widget; +import android.annotation.UnsupportedAppUsage;  import android.content.Context;  import android.content.res.TypedArray;  import android.util.AttributeSet; @@ -40,6 +41,7 @@ public class ButtonBarLayout extends LinearLayout {      private int mMinimumHeight = 0; +    @UnsupportedAppUsage      public ButtonBarLayout(Context context, AttributeSet attrs) {          super(context, attrs); diff --git a/core/java/com/android/internal/widget/DialogTitle.java b/core/java/com/android/internal/widget/DialogTitle.java index 7ea3d6b5bff0..405436c53ff0 100644 --- a/core/java/com/android/internal/widget/DialogTitle.java +++ b/core/java/com/android/internal/widget/DialogTitle.java @@ -16,6 +16,7 @@  package com.android.internal.widget; +import android.annotation.UnsupportedAppUsage;  import android.content.Context;  import android.content.res.TypedArray;  import android.text.Layout; @@ -37,6 +38,7 @@ public class DialogTitle extends TextView {          super(context, attrs, defStyleAttr);      } +    @UnsupportedAppUsage      public DialogTitle(Context context, AttributeSet attrs) {          super(context, attrs);      } diff --git a/core/proto/android/telephony/enums.proto b/core/proto/android/telephony/enums.proto index 32975a5550f1..fba2e51937b3 100644 --- a/core/proto/android/telephony/enums.proto +++ b/core/proto/android/telephony/enums.proto @@ -61,3 +61,64 @@ enum SignalStrengthEnum {      SIGNAL_STRENGTH_GOOD = 3;      SIGNAL_STRENGTH_GREAT = 4;  } + + +enum ServiceStateEnum { +    /** +     * Normal operation condition, the phone is registered +     * with an operator either in home network or in roaming. +     */ +    SERVICE_STATE_IN_SERVICE = 0; + +    /** +     * Phone is not registered with any operator, the phone +     * can be currently searching a new operator to register to, or not +     * searching to registration at all, or registration is denied, or radio +     * signal is not available. +     */ +    SERVICE_STATE_OUT_OF_SERVICE = 1; + +    /** +     * The phone is registered and locked.  Only emergency numbers are allowed. {@more} +     */ +    SERVICE_STATE_EMERGENCY_ONLY = 2; + +    /** +     * Radio of telephony is explicitly powered off. +     */ +    SERVICE_STATE_POWER_OFF = 3; +} + +enum SimStateEnum { +    SIM_STATE_UNKNOWN = 0; +    /** SIM card state: no SIM card is available in the device */ +    SIM_STATE_ABSENT = 1; +    /** SIM card state: Locked: requires the user's SIM PIN to unlock */ +    SIM_STATE_PIN_REQUIRED = 2; +    /** SIM card state: Locked: requires the user's SIM PUK to unlock */ +    SIM_STATE_PUK_REQUIRED = 3; +    /** SIM card state: Locked: requires a network PIN to unlock */ +    SIM_STATE_NETWORK_LOCKED = 4; +    /** SIM card state: Ready */ +    SIM_STATE_READY = 5; +    /** SIM card state: SIM Card is NOT READY */ +    SIM_STATE_NOT_READY = 6; +    /** SIM card state: SIM Card Error, permanently disabled */ +    SIM_STATE_PERM_DISABLED = 7; +    /** SIM card state: SIM Card Error, present but faulty */ +    SIM_STATE_CARD_IO_ERROR = 8; +    /** SIM card state: SIM Card restricted, present but not usable due to +     * carrier restrictions. +     */ +    SIM_STATE_CARD_RESTRICTED = 9; +    /** +     * SIM card state: Loaded: SIM card applications have been loaded +     * @hide +     */ +    SIM_STATE_LOADED = 10; +    /** +     * SIM card state: SIM Card is present +     * @hide +     */ +    SIM_STATE_PRESENT = 11; +} diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 73bb1fc1b4a7..0dabcd72bd86 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -138,7 +138,6 @@      <protected-broadcast android:name="android.bluetooth.device.action.MAS_INSTANCE" />      <protected-broadcast android:name="android.bluetooth.device.action.ALIAS_CHANGED" />      <protected-broadcast android:name="android.bluetooth.device.action.FOUND" /> -    <protected-broadcast android:name="android.bluetooth.device.action.DISAPPEARED" />      <protected-broadcast android:name="android.bluetooth.device.action.CLASS_CHANGED" />      <protected-broadcast android:name="android.bluetooth.device.action.ACL_CONNECTED" />      <protected-broadcast android:name="android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED" /> @@ -1441,6 +1440,7 @@      <!-- Allows SetupWizard to call methods in Networking services           <p>Not for use by any other third-party or privileged applications. +         @SystemApi           @hide This should only be used by SetupWizard.      -->      <permission android:name="android.permission.NETWORK_SETUP_WIZARD" diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml index fb78b3b0533a..7b3d940b91f3 100644 --- a/core/res/res/xml/sms_short_codes.xml +++ b/core/res/res/xml/sms_short_codes.xml @@ -109,12 +109,12 @@      <!-- France: 5 digits, free: 3xxxx, premium [4-8]xxxx, plus EU:           http://clients.txtnation.com/entries/161972-france-premium-sms-short-code-requirements,           visual voicemail code for Orange: 21101 --> -    <shortcode country="fr" premium="[4-8]\\d{4}" free="3\\d{4}|116\\d{3}|21101|20366" /> +    <shortcode country="fr" premium="[4-8]\\d{4}" free="3\\d{4}|116\\d{3}|21101|20366|555|2051" />      <!-- United Kingdom (Great Britain): 4-6 digits, common codes [5-8]xxxx, plus EU:           http://www.short-codes.com/media/Co-regulatoryCodeofPracticeforcommonshortcodes170206.pdf,           visual voicemail code for EE: 887 --> -    <shortcode country="gb" pattern="\\d{4,6}" premium="[5-8]\\d{4}" free="116\\d{3}|2020|35890|61002|61202|887|83669|34664|40406|60174|7726|37726" /> +    <shortcode country="gb" pattern="\\d{4,6}" premium="[5-8]\\d{4}" free="116\\d{3}|2020|35890|61002|61202|887|83669|34664|40406|60174|7726|37726|88555|9017|9018" />      <!-- Georgia: 4 digits, known premium codes listed -->      <shortcode country="ge" pattern="\\d{4}" premium="801[234]|888[239]" /> @@ -189,11 +189,14 @@      <!-- The Netherlands, 4 digits, known premium codes listed, plus EU -->      <shortcode country="nl" pattern="\\d{4}" premium="4466|5040" free="116\\d{3}|2223|6225|2223" /> +    <!-- Nigeria --> +    <shortcode country="ng" pattern="\\d{1,5}" free="2441" /> +      <!-- Norway: 4-5 digits (not confirmed), known premium codes listed -->      <shortcode country="no" pattern="\\d{4,5}" premium="2201|222[67]" free="2171" />      <!-- New Zealand: 3-4 digits, known premium codes listed --> -    <shortcode country="nz" pattern="\\d{3,4}" premium="3903|8995|4679" free="3067|3068|4053" /> +    <shortcode country="nz" pattern="\\d{3,4}" premium="3903|8995|4679" free="1737|2141|3067|3068|3110|4006|4053|4061|4062|4202|4300|4334|4412|4575|5626|8006|8681" />      <!-- Peru: 4-5 digits (not confirmed), known premium codes listed -->      <shortcode country="pe" pattern="\\d{4,5}" free="9963" /> @@ -209,7 +212,7 @@      <!-- Portugal: 5 digits, plus EU:           http://clients.txtnation.com/entries/158326-portugal-premium-sms-short-code-regulations --> -    <shortcode country="pt" premium="6[1289]\\d{3}" free="116\\d{3}|1262" /> +    <shortcode country="pt" premium="6[1289]\\d{3}" free="116\\d{3}|1262|12666" />      <!-- Qatar: 1-5 digits (standard system default, not country specific) -->      <shortcode country="qa" pattern="\\d{1,5}" free="92451" /> diff --git a/core/tests/coretests/Android.mk b/core/tests/coretests/Android.mk index e0d53933b33b..307e2e8671b2 100644 --- a/core/tests/coretests/Android.mk +++ b/core/tests/coretests/Android.mk @@ -67,10 +67,6 @@ LOCAL_RESOURCE_DIR := $(FrameworkCoreTests_intermediates) $(LOCAL_PATH)/res  # Disable AAPT2 because the hacks below depend on the AAPT rules implementation  LOCAL_USE_AAPT2 := false -# When AAPT2 is enabled it will need --warn-manifest-validation to fix: -# frameworks/base/core/tests/coretests/AndroidManifest.xml:26: error: unknown element <meta-data> found. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -# LOCAL_AAPT_FLAGS += --warn-manifest-validation  include $(BUILD_PACKAGE)  # Rules to copy all the test apks to the intermediate raw resource directory diff --git a/core/tests/coretests/apks/install_multi_package/Android.mk b/core/tests/coretests/apks/install_multi_package/Android.mk index 97275931be4b..3f163def9ce0 100644 --- a/core/tests/coretests/apks/install_multi_package/Android.mk +++ b/core/tests/coretests/apks/install_multi_package/Android.mk @@ -8,10 +8,6 @@ LOCAL_SRC_FILES := $(call all-subdir-java-files)  LOCAL_PACKAGE_NAME := install_multi_package  LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# frameworks/base/core/tests/coretests/apks/install_multi_package/AndroidManifest.xml:46: error: unexpected element <package> found in <manifest>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation  include $(FrameworkCoreTests_BUILD_PACKAGE)  #include $(BUILD_PACKAGE) diff --git a/core/tests/coretests/apks/install_verifier_bad/Android.mk b/core/tests/coretests/apks/install_verifier_bad/Android.mk index 679327c9b0df..745b4d32ccc4 100644 --- a/core/tests/coretests/apks/install_verifier_bad/Android.mk +++ b/core/tests/coretests/apks/install_verifier_bad/Android.mk @@ -6,9 +6,5 @@ LOCAL_SRC_FILES := $(call all-subdir-java-files)  LOCAL_PACKAGE_NAME := install_verifier_bad  LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# frameworks/base/core/tests/coretests/apks/install_verifier_bad/AndroidManifest.xml:19: error: unexpected element <package-verifier> found in <manifest>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation  include $(FrameworkCoreTests_BUILD_PACKAGE) diff --git a/core/tests/coretests/apks/install_verifier_good/Android.mk b/core/tests/coretests/apks/install_verifier_good/Android.mk index 7d621b32900b..150fd8dd8701 100644 --- a/core/tests/coretests/apks/install_verifier_good/Android.mk +++ b/core/tests/coretests/apks/install_verifier_good/Android.mk @@ -6,9 +6,5 @@ LOCAL_SRC_FILES := $(call all-subdir-java-files)  LOCAL_PACKAGE_NAME := install_verifier_good  LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# frameworks/base/core/tests/coretests/apks/install_verifier_good/AndroidManifest.xml:19: error: unexpected element <package-verifier> found in <manifest>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation  include $(FrameworkCoreTests_BUILD_PACKAGE) diff --git a/core/tests/coretests/src/android/text/format/DateUtilsTest.java b/core/tests/coretests/src/android/text/format/DateUtilsTest.java index f8e3b4dfec56..872b71a5faa6 100644 --- a/core/tests/coretests/src/android/text/format/DateUtilsTest.java +++ b/core/tests/coretests/src/android/text/format/DateUtilsTest.java @@ -117,7 +117,7 @@ public class DateUtilsTest {      @Test      public void testFormatSameDayTime() {          // This test assumes a default DateFormat.is24Hour setting. -        DateFormat.is24Hour = null; +        DateFormat.set24HourTimePref(null);          Date date = new Date(109, 0, 19, 3, 30, 15);          long fixedTime = date.getTime(); diff --git a/graphics/java/android/graphics/pdf/PdfEditor.java b/graphics/java/android/graphics/pdf/PdfEditor.java index 3821bc7ab063..21ce1b8392d2 100644 --- a/graphics/java/android/graphics/pdf/PdfEditor.java +++ b/graphics/java/android/graphics/pdf/PdfEditor.java @@ -27,7 +27,6 @@ import android.system.Os;  import android.system.OsConstants;  import dalvik.system.CloseGuard;  import libcore.io.IoUtils; -import libcore.io.Libcore;  import java.io.IOException; diff --git a/keystore/OWNERS b/keystore/OWNERS new file mode 100644 index 000000000000..a63ca46df2a6 --- /dev/null +++ b/keystore/OWNERS @@ -0,0 +1,4 @@ +jbires@google.com +jdanis@google.com +robbarnes@google.com +swillden@google.com diff --git a/location/lib/Android.bp b/location/lib/Android.bp index 447195d6d532..b09335c6707f 100644 --- a/location/lib/Android.bp +++ b/location/lib/Android.bp @@ -18,4 +18,5 @@ java_sdk_library {      name: "com.android.location.provider",      srcs: ["java/**/*.java"],      api_packages: ["com.android.location.provider"], +    metalava_enabled: false,  } diff --git a/media/lib/remotedisplay/Android.bp b/media/lib/remotedisplay/Android.bp index 1e9320d1414d..5f4b930f350e 100644 --- a/media/lib/remotedisplay/Android.bp +++ b/media/lib/remotedisplay/Android.bp @@ -14,22 +14,8 @@  // limitations under the License.  // -droiddoc { -    name: "com.android.media.remotedisplay.stubs-gen-docs", -    srcs: [ -        "java/**/*.java", -    ], -    args: " -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " + -          " -stubpackages com.android.media.remotedisplay " + -          " -nodocs ", -    custom_template: "droiddoc-templates-sdk", -    installable: false, -} - -java_library_static { -    name: "com.android.media.remotedisplay.stubs", -    srcs: [ -        ":com.android.media.remotedisplay.stubs-gen-docs", -    ], -    sdk_version: "current", +java_sdk_library { +    name: "com.android.media.remotedisplay", +    srcs: ["java/**/*.java"], +    api_packages: ["com.android.media.remotedisplay"],  } diff --git a/media/lib/remotedisplay/Android.mk b/media/lib/remotedisplay/Android.mk deleted file mode 100644 index e88c0f1a8dc8..000000000000 --- a/media/lib/remotedisplay/Android.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright (C) 2013 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -#      http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -LOCAL_PATH := $(call my-dir) - -# the remotedisplay library -# ============================================================ -include $(CLEAR_VARS) - -LOCAL_MODULE:= com.android.media.remotedisplay -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(call all-java-files-under, java) - -include $(BUILD_JAVA_LIBRARY) - - -# ====  com.android.media.remotedisplay.xml lib def  ======================== -include $(CLEAR_VARS) - -LOCAL_MODULE := com.android.media.remotedisplay.xml -LOCAL_MODULE_TAGS := optional - -LOCAL_MODULE_CLASS := ETC - -# This will install the file in /system/etc/permissions -# -LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions - -LOCAL_SRC_FILES := $(LOCAL_MODULE) - -include $(BUILD_PREBUILT) diff --git a/media/lib/remotedisplay/api/current.txt b/media/lib/remotedisplay/api/current.txt new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/media/lib/remotedisplay/api/current.txt diff --git a/media/lib/remotedisplay/api/removed.txt b/media/lib/remotedisplay/api/removed.txt new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/media/lib/remotedisplay/api/removed.txt diff --git a/media/lib/remotedisplay/api/system-current.txt b/media/lib/remotedisplay/api/system-current.txt new file mode 100644 index 000000000000..69bbd35fce59 --- /dev/null +++ b/media/lib/remotedisplay/api/system-current.txt @@ -0,0 +1,52 @@ +package com.android.media.remotedisplay { + +  public class RemoteDisplay { +    ctor public RemoteDisplay(java.lang.String, java.lang.String); +    method public java.lang.String getDescription(); +    method public java.lang.String getId(); +    method public java.lang.String getName(); +    method public int getPresentationDisplayId(); +    method public int getStatus(); +    method public int getVolume(); +    method public int getVolumeHandling(); +    method public int getVolumeMax(); +    method public void setDescription(java.lang.String); +    method public void setName(java.lang.String); +    method public void setPresentationDisplayId(int); +    method public void setStatus(int); +    method public void setVolume(int); +    method public void setVolumeHandling(int); +    method public void setVolumeMax(int); +    field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0 +    field public static final int PLAYBACK_VOLUME_VARIABLE = 1; // 0x1 +    field public static final int STATUS_AVAILABLE = 2; // 0x2 +    field public static final int STATUS_CONNECTED = 4; // 0x4 +    field public static final int STATUS_CONNECTING = 3; // 0x3 +    field public static final int STATUS_IN_USE = 1; // 0x1 +    field public static final int STATUS_NOT_AVAILABLE = 0; // 0x0 +  } + +  public abstract class RemoteDisplayProvider { +    ctor public RemoteDisplayProvider(android.content.Context); +    method public void addDisplay(com.android.media.remotedisplay.RemoteDisplay); +    method public com.android.media.remotedisplay.RemoteDisplay findRemoteDisplay(java.lang.String); +    method public android.os.IBinder getBinder(); +    method public final android.content.Context getContext(); +    method public int getDiscoveryMode(); +    method public java.util.Collection<com.android.media.remotedisplay.RemoteDisplay> getDisplays(); +    method public android.app.PendingIntent getSettingsPendingIntent(); +    method public void onAdjustVolume(com.android.media.remotedisplay.RemoteDisplay, int); +    method public void onConnect(com.android.media.remotedisplay.RemoteDisplay); +    method public void onDisconnect(com.android.media.remotedisplay.RemoteDisplay); +    method public void onDiscoveryModeChanged(int); +    method public void onSetVolume(com.android.media.remotedisplay.RemoteDisplay, int); +    method public void removeDisplay(com.android.media.remotedisplay.RemoteDisplay); +    method public void updateDisplay(com.android.media.remotedisplay.RemoteDisplay); +    field public static final int DISCOVERY_MODE_ACTIVE = 2; // 0x2 +    field public static final int DISCOVERY_MODE_NONE = 0; // 0x0 +    field public static final int DISCOVERY_MODE_PASSIVE = 1; // 0x1 +    field public static final java.lang.String SERVICE_INTERFACE = "com.android.media.remotedisplay.RemoteDisplayProvider"; +  } + +} + diff --git a/media/lib/remotedisplay/api/system-removed.txt b/media/lib/remotedisplay/api/system-removed.txt new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/media/lib/remotedisplay/api/system-removed.txt diff --git a/media/lib/remotedisplay/api/test-current.txt b/media/lib/remotedisplay/api/test-current.txt new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/media/lib/remotedisplay/api/test-current.txt diff --git a/media/lib/remotedisplay/api/test-removed.txt b/media/lib/remotedisplay/api/test-removed.txt new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/media/lib/remotedisplay/api/test-removed.txt diff --git a/media/lib/remotedisplay/com.android.media.remotedisplay.xml b/media/lib/remotedisplay/com.android.media.remotedisplay.xml deleted file mode 100644 index 77a91d23e1d8..000000000000 --- a/media/lib/remotedisplay/com.android.media.remotedisplay.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2013 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. ---> - -<permissions> -    <library name="com.android.media.remotedisplay" -            file="/system/framework/com.android.media.remotedisplay.jar" /> -</permissions> diff --git a/media/lib/remotedisplay/java/com/android/media/remotedisplay/RemoteDisplay.java b/media/lib/remotedisplay/java/com/android/media/remotedisplay/RemoteDisplay.java index dc9dd79eb2b1..8de414b45a4d 100644 --- a/media/lib/remotedisplay/java/com/android/media/remotedisplay/RemoteDisplay.java +++ b/media/lib/remotedisplay/java/com/android/media/remotedisplay/RemoteDisplay.java @@ -16,6 +16,7 @@  package com.android.media.remotedisplay; +import android.annotation.SystemApi;  import android.media.RemoteDisplayState.RemoteDisplayInfo;  import android.text.TextUtils; @@ -23,7 +24,10 @@ import java.util.Objects;  /**   * Represents a remote display that has been discovered. + * + * @hide   */ +@SystemApi  public class RemoteDisplay {      private final RemoteDisplayInfo mMutableInfo;      private RemoteDisplayInfo mImmutableInfo; diff --git a/media/lib/remotedisplay/java/com/android/media/remotedisplay/RemoteDisplayProvider.java b/media/lib/remotedisplay/java/com/android/media/remotedisplay/RemoteDisplayProvider.java index 4d3edb896eb5..7017e444d717 100644 --- a/media/lib/remotedisplay/java/com/android/media/remotedisplay/RemoteDisplayProvider.java +++ b/media/lib/remotedisplay/java/com/android/media/remotedisplay/RemoteDisplayProvider.java @@ -16,6 +16,7 @@  package com.android.media.remotedisplay; +import android.annotation.SystemApi;  import android.app.PendingIntent;  import android.app.Service;  import android.content.Context; @@ -88,7 +89,10 @@ import java.util.Collection;   * IMPORTANT: This class is effectively a public API for unbundled applications, and   * must remain API stable. See README.txt in the root of this package for more information.   * </p> + * + * @hide   */ +@SystemApi  public abstract class RemoteDisplayProvider {      private static final int MSG_SET_CALLBACK = 1;      private static final int MSG_SET_DISCOVERY_MODE = 2; diff --git a/media/lib/signer/Android.bp b/media/lib/signer/Android.bp index 3b2578754087..8c43683c2eec 100644 --- a/media/lib/signer/Android.bp +++ b/media/lib/signer/Android.bp @@ -18,4 +18,5 @@ java_sdk_library {      name: "com.android.mediadrm.signer",      srcs: ["java/**/*.java"],      api_packages: ["com.android.mediadrm.signer"], +    metalava_enabled: false,  } diff --git a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/DeviceDiscoveryService.java b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/DeviceDiscoveryService.java index cdaabdcda20f..d0ca04bb07c2 100644 --- a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/DeviceDiscoveryService.java +++ b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/DeviceDiscoveryService.java @@ -184,7 +184,6 @@ public class DeviceDiscoveryService extends Service {          if (shouldScan(mBluetoothFilters)) {              final IntentFilter intentFilter = new IntentFilter();              intentFilter.addAction(BluetoothDevice.ACTION_FOUND); -            intentFilter.addAction(BluetoothDevice.ACTION_DISAPPEARED);              mBluetoothBroadcastReceiver = new BluetoothBroadcastReceiver();              registerReceiver(mBluetoothBroadcastReceiver, intentFilter); diff --git a/packages/CtsShim/build/Android.mk b/packages/CtsShim/build/Android.mk index e645adc60b7c..03eb0d9aad5a 100644 --- a/packages/CtsShim/build/Android.mk +++ b/packages/CtsShim/build/Android.mk @@ -67,10 +67,6 @@ LOCAL_MULTILIB := both  LOCAL_JNI_SHARED_LIBRARIES := libshim_jni  LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# out/target/common/obj/APPS/CtsShimPriv_intermediates/AndroidManifest.xml:25: error: unexpected element <restrict-update> found in <manifest>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation  include $(BUILD_PACKAGE) @@ -113,10 +109,6 @@ LOCAL_PACKAGE_NAME := CtsShim  LOCAL_MANIFEST_FILE := shim/AndroidManifest.xml  LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# frameworks/base/packages/CtsShim/build/shim/AndroidManifest.xml:25: error: unexpected element <restrict-update> found in <manifest>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation  include $(BUILD_PACKAGE) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java index 0b58c9dd0355..9d8336f14f85 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java @@ -97,7 +97,6 @@ public class BluetoothEventManager {          addHandler(BluetoothAdapter.ACTION_DISCOVERY_STARTED, new ScanningStateChangedHandler(true));          addHandler(BluetoothAdapter.ACTION_DISCOVERY_FINISHED, new ScanningStateChangedHandler(false));          addHandler(BluetoothDevice.ACTION_FOUND, new DeviceFoundHandler()); -        addHandler(BluetoothDevice.ACTION_DISAPPEARED, new DeviceDisappearedHandler());          addHandler(BluetoothDevice.ACTION_NAME_CHANGED, new NameChangedHandler());          addHandler(BluetoothDevice.ACTION_ALIAS_CHANGED, new NameChangedHandler()); @@ -280,24 +279,6 @@ public class BluetoothEventManager {          }      } -    private class DeviceDisappearedHandler implements Handler { -        public void onReceive(Context context, Intent intent, -                BluetoothDevice device) { -            CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device); -            if (cachedDevice == null) { -                Log.w(TAG, "received ACTION_DISAPPEARED for an unknown device: " + device); -                return; -            } -            if (CachedBluetoothDeviceManager.onDeviceDisappeared(cachedDevice)) { -                synchronized (mCallbacks) { -                    for (BluetoothCallback callback : mCallbacks) { -                        callback.onDeviceDeleted(cachedDevice); -                    } -                } -            } -        } -    } -      private class NameChangedHandler implements Handler {          public void onReceive(Context context, Intent intent,                  BluetoothDevice device) { diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunablePadding.java b/packages/SystemUI/src/com/android/systemui/tuner/TunablePadding.java index af99236cc393..e85dee841715 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/TunablePadding.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/TunablePadding.java @@ -51,7 +51,9 @@ public class TunablePadding implements Tunable {      public void onTuningChanged(String key, String newValue) {          int dimen = mDefaultSize;          if (newValue != null) { -            dimen = (int) (Integer.parseInt(newValue) * mDensity); +            try { +                dimen = (int) (Integer.parseInt(newValue) * mDensity); +            } catch (NumberFormatException ex) {}          }          int left = mView.isLayoutRtl() ? FLAG_END : FLAG_START;          int right = mView.isLayoutRtl() ? FLAG_START : FLAG_END; diff --git a/services/core/Android.bp b/services/core/Android.bp index cae15bad5414..8cfbda2de776 100644 --- a/services/core/Android.bp +++ b/services/core/Android.bp @@ -4,6 +4,7 @@ java_library_static {      aidl: {          include_dirs: [              "frameworks/native/aidl/binder", +            "frameworks/native/cmds/dumpstate/binder",              "system/core/storaged/binder",              "system/netd/server/binder",              "system/vold/binder", @@ -11,6 +12,7 @@ java_library_static {      },      srcs: [          "java/**/*.java", +        ":dumpstate_aidl",          ":netd_aidl",          ":netd_metrics_aidl",          ":installd_aidl", @@ -43,6 +45,7 @@ java_library_static {          "android.hardware.configstore-V1.0-java",          "android.hardware.contexthub-V1.0-java",          "android.hidl.manager-V1.0-java", +        "netd_aidl_interface-java",      ],  } diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 5e8ffb79c493..bc6254a76327 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -1679,6 +1679,16 @@ public class ConnectivityService extends IConnectivityManager.Stub                  "ConnectivityService");      } +    private void enforceAnyPermissionOf(String... permissions) { +        for (String permission : permissions) { +            if (mContext.checkCallingOrSelfPermission(permission) == PERMISSION_GRANTED) { +                return; +            } +        } +        throw new SecurityException( +            "Requires one of the following permissions: " + String.join(", ", permissions) + "."); +    } +      private void enforceInternetPermission() {          mContext.enforceCallingOrSelfPermission(                  android.Manifest.permission.INTERNET, @@ -1723,6 +1733,13 @@ public class ConnectivityService extends IConnectivityManager.Stub                  "ConnectivityService");      } +    private void enforceNetworkStackSettingsOrSetup() { +        enforceAnyPermissionOf( +            android.Manifest.permission.NETWORK_SETTINGS, +            android.Manifest.permission.NETWORK_SETUP_WIZARD, +            android.Manifest.permission.NETWORK_STACK); +    } +      private boolean checkNetworkStackPermission() {          return PERMISSION_GRANTED == mContext.checkCallingOrSelfPermission(                  android.Manifest.permission.NETWORK_STACK); @@ -1798,7 +1815,8 @@ public class ConnectivityService extends IConnectivityManager.Stub      private void sendStickyBroadcast(Intent intent) {          synchronized (this) { -            if (!mSystemReady) { +            if (!mSystemReady +                    && intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {                  mInitialBroadcast = new Intent(intent);              }              intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); @@ -1847,8 +1865,6 @@ public class ConnectivityService extends IConnectivityManager.Stub                  mInitialBroadcast = null;              }          } -        // load the global proxy at startup -        mHandler.sendMessage(mHandler.obtainMessage(EVENT_APPLY_GLOBAL_HTTP_PROXY));          // Try bringing up tracker, but KeyStore won't be ready yet for secondary users so wait          // for user to unlock device too. @@ -3089,7 +3105,7 @@ public class ConnectivityService extends IConnectivityManager.Stub                      break;                  }                  case EVENT_APPLY_GLOBAL_HTTP_PROXY: { -                    handleDeprecatedGlobalHttpProxy(); +                    mProxyTracker.loadDeprecatedGlobalHttpProxy();                      break;                  }                  case EVENT_PROXY_HAS_CHANGED: { @@ -3483,29 +3499,6 @@ public class ConnectivityService extends IConnectivityManager.Stub          }      } -    private void handleDeprecatedGlobalHttpProxy() { -        final String proxy = Settings.Global.getString(mContext.getContentResolver(), -                Settings.Global.HTTP_PROXY); -        if (!TextUtils.isEmpty(proxy)) { -            String data[] = proxy.split(":"); -            if (data.length == 0) { -                return; -            } - -            final String proxyHost = data[0]; -            int proxyPort = 8080; -            if (data.length > 1) { -                try { -                    proxyPort = Integer.parseInt(data[1]); -                } catch (NumberFormatException e) { -                    return; -                } -            } -            final ProxyInfo p = new ProxyInfo(proxyHost, proxyPort, ""); -            setGlobalProxy(p); -        } -    } -      private static class SettingsObserver extends ContentObserver {          final private HashMap<Uri, Integer> mUriEventMap;          final private Context mContext; @@ -4008,7 +4001,7 @@ public class ConnectivityService extends IConnectivityManager.Stub      @Override      public void setAirplaneMode(boolean enable) { -        enforceConnectivityInternalPermission(); +        enforceNetworkStackSettingsOrSetup();          final long ident = Binder.clearCallingIdentity();          try {              final ContentResolver cr = mContext.getContentResolver(); @@ -5537,15 +5530,7 @@ public class ConnectivityService extends IConnectivityManager.Stub              if (networkAgent.isVPN()) {                  // Temporarily disable the default proxy (not global). -                synchronized (mProxyTracker.mProxyLock) { -                    if (!mProxyTracker.mDefaultProxyDisabled) { -                        mProxyTracker.mDefaultProxyDisabled = true; -                        if (mProxyTracker.mGlobalProxy == null -                                && mProxyTracker.mDefaultProxy != null) { -                            mProxyTracker.sendProxyBroadcast(null); -                        } -                    } -                } +                mProxyTracker.setDefaultProxyEnabled(false);                  // TODO: support proxy per network.              } @@ -5567,15 +5552,7 @@ public class ConnectivityService extends IConnectivityManager.Stub          } else if (state == NetworkInfo.State.DISCONNECTED) {              networkAgent.asyncChannel.disconnect();              if (networkAgent.isVPN()) { -                synchronized (mProxyTracker.mProxyLock) { -                    if (mProxyTracker.mDefaultProxyDisabled) { -                        mProxyTracker.mDefaultProxyDisabled = false; -                        if (mProxyTracker.mGlobalProxy == null -                                && mProxyTracker.mDefaultProxy != null) { -                            mProxyTracker.sendProxyBroadcast(mProxyTracker.mDefaultProxy); -                        } -                    } -                } +                mProxyTracker.setDefaultProxyEnabled(true);                  updateUids(networkAgent, networkAgent.networkCapabilities, null);              }              disconnectAndDestroyNetwork(networkAgent); diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java index ab0a56516ff4..94a15f7d7312 100644 --- a/services/core/java/com/android/server/NetworkManagementService.java +++ b/services/core/java/com/android/server/NetworkManagementService.java @@ -57,6 +57,7 @@ import android.content.ContentResolver;  import android.content.Context;  import android.net.ConnectivityManager;  import android.net.INetd; +import android.net.TetherStatsParcel;  import android.net.INetworkManagementEventObserver;  import android.net.ITetheringStatsProvider;  import android.net.InterfaceConfiguration; @@ -1839,31 +1840,30 @@ public class NetworkManagementService extends INetworkManagementService.Stub                  return new NetworkStats(SystemClock.elapsedRealtime(), 0);              } -            final PersistableBundle bundle; +            final TetherStatsParcel[] tetherStatsVec;              try { -                bundle = mNetdService.tetherGetStats(); +                tetherStatsVec = mNetdService.tetherGetStats();              } catch (RemoteException | ServiceSpecificException e) {                  throw new IllegalStateException("problem parsing tethering stats: ", e);              }              final NetworkStats stats = new NetworkStats(SystemClock.elapsedRealtime(), -                    bundle.size()); +                tetherStatsVec.length);              final NetworkStats.Entry entry = new NetworkStats.Entry(); -            for (String iface : bundle.keySet()) { -                long[] statsArray = bundle.getLongArray(iface); +            for (TetherStatsParcel tetherStats : tetherStatsVec) {                  try { -                    entry.iface = iface; +                    entry.iface = tetherStats.iface;                      entry.uid = UID_TETHERING;                      entry.set = SET_DEFAULT;                      entry.tag = TAG_NONE; -                    entry.rxBytes   = statsArray[INetd.TETHER_STATS_RX_BYTES]; -                    entry.rxPackets = statsArray[INetd.TETHER_STATS_RX_PACKETS]; -                    entry.txBytes   = statsArray[INetd.TETHER_STATS_TX_BYTES]; -                    entry.txPackets = statsArray[INetd.TETHER_STATS_TX_PACKETS]; +                    entry.rxBytes   = tetherStats.rxBytes; +                    entry.rxPackets = tetherStats.rxPackets; +                    entry.txBytes   = tetherStats.txBytes; +                    entry.txPackets = tetherStats.txPackets;                      stats.combineValues(entry);                  } catch (ArrayIndexOutOfBoundsException e) { -                    throw new IllegalStateException("invalid tethering stats for " + iface, e); +                    throw new IllegalStateException("invalid tethering stats " + e);                  }              } diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index 51c6aa16361a..c17a4cf43854 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -49,6 +49,7 @@ import android.telephony.SubscriptionManager;  import android.telephony.TelephonyManager;  import android.telephony.VoLteServiceState;  import android.util.LocalLog; +import android.util.StatsLog;  import com.android.internal.annotations.VisibleForTesting;  import com.android.internal.app.IBatteryStats; @@ -1684,8 +1685,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {          try {              if (state == TelephonyManager.CALL_STATE_IDLE) {                  mBatteryStats.notePhoneOff(); +                StatsLog.write(StatsLog.PHONE_STATE_CHANGED, +                        StatsLog.PHONE_STATE_CHANGED__STATE__OFF);              } else {                  mBatteryStats.notePhoneOn(); +                StatsLog.write(StatsLog.PHONE_STATE_CHANGED, +                        StatsLog.PHONE_STATE_CHANGED__STATE__ON);              }          } catch (RemoteException e) {              /* The remote entity disappeared, we can safely ignore the exception. */ diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java index ca9b25699c1c..30659c1e77a3 100644 --- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java +++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java @@ -1031,6 +1031,11 @@ public class NetworkMonitor extends StateMachine {                  result.isPortal() /* isCaptivePortal */,                  startTime, endTime); +        log("isCaptivePortal: isSuccessful()=" + result.isSuccessful() + +                " isPortal()=" + result.isPortal() + +                " RedirectUrl=" + result.redirectUrl + +                " StartTime=" + startTime + " EndTime=" + endTime); +          return result;      } diff --git a/services/core/java/com/android/server/connectivity/ProxyTracker.java b/services/core/java/com/android/server/connectivity/ProxyTracker.java index b7bbd422458f..47e85b5fd3ab 100644 --- a/services/core/java/com/android/server/connectivity/ProxyTracker.java +++ b/services/core/java/com/android/server/connectivity/ProxyTracker.java @@ -16,6 +16,12 @@  package com.android.server.connectivity; +import static android.provider.Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST; +import static android.provider.Settings.Global.GLOBAL_HTTP_PROXY_HOST; +import static android.provider.Settings.Global.GLOBAL_HTTP_PROXY_PAC; +import static android.provider.Settings.Global.GLOBAL_HTTP_PROXY_PORT; +import static android.provider.Settings.Global.HTTP_PROXY; +  import android.annotation.NonNull;  import android.annotation.Nullable;  import android.content.ContentResolver; @@ -47,16 +53,14 @@ public class ProxyTracker {      @NonNull      private final Context mContext; -    // TODO : make this private and import as much managing logic from ConnectivityService as -    // possible      @NonNull -    public final Object mProxyLock = new Object(); +    private final Object mProxyLock = new Object();      // The global proxy is the proxy that is set device-wide, overriding any network-specific      // proxy. Note however that proxies are hints ; the system does not enforce their use. Hence      // this value is only for querying.      @Nullable      @GuardedBy("mProxyLock") -    public ProxyInfo mGlobalProxy = null; +    private ProxyInfo mGlobalProxy = null;      // The default proxy is the proxy that applies to no particular network if the global proxy      // is not set. Individual networks have their own settings that override this. This member      // is set through setDefaultProxy, which is called when the default network changes proxies @@ -64,10 +68,10 @@ public class ProxyTracker {      // when PacManager resolves the proxy.      @Nullable      @GuardedBy("mProxyLock") -    public volatile ProxyInfo mDefaultProxy = null; -    // Whether the default proxy is disabled. TODO : make this mDefaultProxyEnabled +    private volatile ProxyInfo mDefaultProxy = null; +    // Whether the default proxy is enabled.      @GuardedBy("mProxyLock") -    public boolean mDefaultProxyDisabled = false; +    private boolean mDefaultProxyEnabled = true;      // The object responsible for Proxy Auto Configuration (PAC).      @NonNull @@ -85,7 +89,7 @@ public class ProxyTracker {      @Nullable      private static ProxyInfo canonicalizeProxyInfo(@Nullable final ProxyInfo proxy) {          if (proxy != null && TextUtils.isEmpty(proxy.getHost()) -                && (proxy.getPacFileUrl() == null || Uri.EMPTY.equals(proxy.getPacFileUrl()))) { +                && Uri.EMPTY.equals(proxy.getPacFileUrl())) {              return null;          }          return proxy; @@ -123,7 +127,7 @@ public class ProxyTracker {          // This information is already available as a world read/writable jvm property.          synchronized (mProxyLock) {              final ProxyInfo ret = mGlobalProxy; -            if ((ret == null) && !mDefaultProxyDisabled) return mDefaultProxy; +            if ((ret == null) && mDefaultProxyEnabled) return mDefaultProxy;              return ret;          }      } @@ -146,11 +150,10 @@ public class ProxyTracker {       */      public void loadGlobalProxy() {          ContentResolver res = mContext.getContentResolver(); -        String host = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST); -        int port = Settings.Global.getInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, 0); -        String exclList = Settings.Global.getString(res, -                Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); -        String pacFileUrl = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_PAC); +        String host = Settings.Global.getString(res, GLOBAL_HTTP_PROXY_HOST); +        int port = Settings.Global.getInt(res, GLOBAL_HTTP_PROXY_PORT, 0); +        String exclList = Settings.Global.getString(res, GLOBAL_HTTP_PROXY_EXCLUSION_LIST); +        String pacFileUrl = Settings.Global.getString(res, GLOBAL_HTTP_PROXY_PAC);          if (!TextUtils.isEmpty(host) || !TextUtils.isEmpty(pacFileUrl)) {              ProxyInfo proxyProperties;              if (!TextUtils.isEmpty(pacFileUrl)) { @@ -167,10 +170,36 @@ public class ProxyTracker {                  mGlobalProxy = proxyProperties;              }          } +        loadDeprecatedGlobalHttpProxy();          // TODO : shouldn't this function call mPacManager.setCurrentProxyScriptUrl ?      }      /** +     * Read the global proxy from the deprecated Settings.Global.HTTP_PROXY setting and apply it. +     */ +    public void loadDeprecatedGlobalHttpProxy() { +        final String proxy = Settings.Global.getString(mContext.getContentResolver(), HTTP_PROXY); +        if (!TextUtils.isEmpty(proxy)) { +            String data[] = proxy.split(":"); +            if (data.length == 0) { +                return; +            } + +            final String proxyHost = data[0]; +            int proxyPort = 8080; +            if (data.length > 1) { +                try { +                    proxyPort = Integer.parseInt(data[1]); +                } catch (NumberFormatException e) { +                    return; +                } +            } +            final ProxyInfo p = new ProxyInfo(proxyHost, proxyPort, ""); +            setGlobalProxy(p); +        } +    } + +    /**       * Sends the system broadcast informing apps about a new proxy configuration.       *       * Confusingly this method also sets the PAC file URL. TODO : separate this, it has nothing @@ -232,11 +261,10 @@ public class ProxyTracker {              final ContentResolver res = mContext.getContentResolver();              final long token = Binder.clearCallingIdentity();              try { -                Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST, host); -                Settings.Global.putInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, port); -                Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST, -                        exclList); -                Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_PAC, pacFileUrl); +                Settings.Global.putString(res, GLOBAL_HTTP_PROXY_HOST, host); +                Settings.Global.putInt(res, GLOBAL_HTTP_PROXY_PORT, port); +                Settings.Global.putString(res, GLOBAL_HTTP_PROXY_EXCLUSION_LIST, exclList); +                Settings.Global.putString(res, GLOBAL_HTTP_PROXY_PAC, pacFileUrl);              } finally {                  Binder.restoreCallingIdentity(token);              } @@ -253,10 +281,7 @@ public class ProxyTracker {       */      public void setDefaultProxy(@Nullable ProxyInfo proxyInfo) {          synchronized (mProxyLock) { -            if (mDefaultProxy != null && mDefaultProxy.equals(proxyInfo)) { -                return; -            } -            if (mDefaultProxy == proxyInfo) return; // catches repeated nulls +            if (Objects.equals(mDefaultProxy, proxyInfo)) return;              if (proxyInfo != null &&  !proxyInfo.isValid()) {                  if (DBG) Slog.d(TAG, "Invalid proxy properties, ignoring: " + proxyInfo);                  return; @@ -277,9 +302,27 @@ public class ProxyTracker {              mDefaultProxy = proxyInfo;              if (mGlobalProxy != null) return; -            if (!mDefaultProxyDisabled) { +            if (mDefaultProxyEnabled) {                  sendProxyBroadcast(proxyInfo);              }          }      } + +    /** +     * Enable or disable the default proxy. +     * +     * This sets the flag for enabling/disabling the default proxy and sends the broadcast +     * if applicable. +     * @param enabled whether the default proxy should be enabled. +     */ +    public void setDefaultProxyEnabled(final boolean enabled) { +        synchronized (mProxyLock) { +            if (mDefaultProxyEnabled != enabled) { +                mDefaultProxyEnabled = enabled; +                if (mGlobalProxy == null && mDefaultProxy != null) { +                    sendProxyBroadcast(enabled ? mDefaultProxy : null); +                } +            } +        } +    }  } diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java index 390c0ccb3c6e..1fcb37f7aecc 100644 --- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java @@ -60,8 +60,6 @@ import android.util.proto.ProtoOutputStream;  import dalvik.system.VMRuntime;  import libcore.io.IoUtils; -import libcore.io.Libcore; -import libcore.io.Streams;  import java.io.BufferedReader;  import java.io.File; diff --git a/services/core/java/com/android/server/pm/dex/TEST_MAPPING b/services/core/java/com/android/server/pm/dex/TEST_MAPPING index ad5255904d20..c93af2a5ba41 100644 --- a/services/core/java/com/android/server/pm/dex/TEST_MAPPING +++ b/services/core/java/com/android/server/pm/dex/TEST_MAPPING @@ -1,19 +1,12 @@  {    "presubmit": [      { -      "name": "DexLoggerTests" -    }, -    { -      "name": "DexManagerTests" -    }, -    { -      "name": "DexoptOptionsTests" -    }, -    { -      "name": "DexoptUtilsTest" -    }, -    { -      "name": "PackageDexUsageTests" +      "name": "FrameworksServicesTests", +      "options": [ +        { +          "include-filter": "com.android.server.pm.dex" +        } +      ]      },      {        "name": "DexLoggerIntegrationTests" diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java b/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java index 1cba1c7bed1b..a55b49fe028d 100644 --- a/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java +++ b/services/core/java/com/android/server/policy/keyguard/KeyguardStateMonitor.java @@ -95,10 +95,22 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub {          mIsShowing = showing;          mCallback.onShowingChanged(); -        try { -            mKeystoreService.onKeyguardVisibilityChanged(showing, mCurrentUserId); -        } catch (RemoteException e) { -            Slog.e(TAG, "Error informing keystore of screen lock", e); +        int retry = 2; +        while (retry > 0) { +            try { +                mKeystoreService.onKeyguardVisibilityChanged(showing, mCurrentUserId); +                break; +            } catch (RemoteException e) { +                if (retry == 2) { +                    Slog.w(TAG, "Error informing keystore of screen lock. Keystore may have died" +                            + " -> refreshing service token and retrying"); +                    mKeystoreService = IKeystoreService.Stub.asInterface(ServiceManager +                            .getService("android.security.keystore")); +                } else { +                    Slog.e(TAG, "Error informing keystore of screen lock after retrying once", e); +                } +                --retry; +            }          }      } diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 82a28954a8c6..439f313e0f0a 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -459,6 +459,12 @@ public final class SystemServer {              }          } +        // Diagnostic to ensure that the system is in a base healthy state. Done here as a common +        // non-zygote process. +        if (!VMRuntime.hasBootImageSpaces()) { +            Slog.wtf(TAG, "Runtime is not running with a boot image!"); +        } +          // Loop forever.          Looper.loop();          throw new RuntimeException("Main thread loop unexpectedly exited"); diff --git a/services/net/java/android/net/ip/IpNeighborMonitor.java b/services/net/java/android/net/ip/IpNeighborMonitor.java index fc07aa1ecd17..9512f1be66ef 100644 --- a/services/net/java/android/net/ip/IpNeighborMonitor.java +++ b/services/net/java/android/net/ip/IpNeighborMonitor.java @@ -40,7 +40,6 @@ import android.util.Log;  import com.android.internal.util.BitUtils;  import libcore.io.IoUtils; -import libcore.io.Libcore;  import java.io.FileDescriptor;  import java.net.InetAddress; diff --git a/services/net/java/android/net/ip/RouterAdvertisementDaemon.java b/services/net/java/android/net/ip/RouterAdvertisementDaemon.java index 9d686efcb2ab..d197d017acce 100644 --- a/services/net/java/android/net/ip/RouterAdvertisementDaemon.java +++ b/services/net/java/android/net/ip/RouterAdvertisementDaemon.java @@ -28,7 +28,6 @@ import android.net.TrafficStats;  import android.net.util.InterfaceParams;  import android.system.ErrnoException;  import android.system.Os; -import android.system.StructGroupReq;  import android.system.StructTimeval;  import android.util.Log; diff --git a/services/net/java/android/net/netlink/NetlinkSocket.java b/services/net/java/android/net/netlink/NetlinkSocket.java index cfcba3a84f51..40098c1532b1 100644 --- a/services/net/java/android/net/netlink/NetlinkSocket.java +++ b/services/net/java/android/net/netlink/NetlinkSocket.java @@ -32,7 +32,6 @@ import android.system.Os;  import android.system.StructTimeval;  import android.util.Log;  import libcore.io.IoUtils; -import libcore.io.Libcore;  import java.io.FileDescriptor;  import java.io.InterruptedIOException; diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityLaunchParamsModifierTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityLaunchParamsModifierTests.java index 089dc61fc250..f741c70e4821 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityLaunchParamsModifierTests.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityLaunchParamsModifierTests.java @@ -16,16 +16,6 @@  package com.android.server.am; -import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; -import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; - -import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_DONE; -import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_SKIP; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -  import android.app.ActivityOptions;  import android.content.pm.ActivityInfo;  import android.graphics.Rect; @@ -34,16 +24,26 @@ import android.support.test.filters.MediumTest;  import android.support.test.runner.AndroidJUnit4;  import com.android.server.am.LaunchParamsController.LaunchParams; - +import org.junit.runner.RunWith;  import org.junit.Before;  import org.junit.Test; -import org.junit.runner.RunWith; + +import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; +import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; +import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_DONE; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.doAnswer; + +import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_SKIP;  /**   * Tests for exercising resizing bounds due to activity options.   *   * Build/Install/Run: - *  atest WmTests:ActivityLaunchParamsModifierTests + *  atest FrameworksServicesTests:ActivityLaunchParamsModifierTests   */  @MediumTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityManagerInternalTest.java b/services/tests/servicestests/src/com/android/server/am/ActivityManagerInternalTest.java index f393d14e1cfb..bce87dc58819 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityManagerInternalTest.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityManagerInternalTest.java @@ -33,8 +33,17 @@ import org.mockito.MockitoAnnotations;  /**   * Test class for {@link ActivityManagerInternal}.   * - * Build/Install/Run: - *  atest WmTests:ActivityManagerInternalTest + * To run the tests, use + * + * runtest -c com.android.server.am.ActivityManagerInternalTest frameworks-services + * + * or the following steps: + * + * Build: m FrameworksServicesTests + * Install: adb install -r \ + *     ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk + * Run: adb shell am instrument -e class com.android.server.am.ActivityManagerInternalTest -w \ + *     com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner   */  @RunWith(AndroidJUnit4.class)  public class ActivityManagerInternalTest { diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/am/ActivityManagerServiceTest.java index c41197dca2d7..c70d1e18c871 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityManagerServiceTest.java @@ -28,7 +28,6 @@ import static android.app.ActivityManager.PROCESS_STATE_RECEIVER;  import static android.app.ActivityManager.PROCESS_STATE_SERVICE;  import static android.app.ActivityManager.PROCESS_STATE_TOP;  import static android.util.DebugUtils.valueToString; -  import static com.android.server.am.ActivityManagerInternalTest.CustomThread;  import static com.android.server.am.ActivityManagerService.DISPATCH_UIDS_CHANGED_UI_MSG;  import static com.android.server.am.ActivityManagerService.Injector; @@ -89,8 +88,17 @@ import java.util.function.Function;  /**   * Test class for {@link ActivityManagerService}.   * - * Build/Install/Run: - *  atest WmTests:ActivityManagerServiceTest + * To run the tests, use + * + * runtest -c com.android.server.am.ActivityManagerServiceTest frameworks-services + * + * or the following steps: + * + * Build: m FrameworksServicesTests + * Install: adb install -r \ + *     ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk + * Run: adb shell am instrument -e class com.android.server.am.ActivityManagerServiceTest -w \ + *     com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner   */  @SmallTest  @RunWith(AndroidJUnit4.class) @@ -822,4 +830,4 @@ public class ActivityManagerServiceTest {              mRestricted = restricted;          }      } -} +}
\ No newline at end of file diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityManagerTest.java b/services/tests/servicestests/src/com/android/server/am/ActivityManagerTest.java index a2f942e7f96e..ba25b1659bd2 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityManagerTest.java @@ -18,18 +18,13 @@ package com.android.server.am;  import android.app.ActivityManager;  import android.app.IActivityManager; -import android.os.RemoteException; +import android.os.ServiceManager;  import android.os.UserHandle; +import android.os.RemoteException;  import android.test.AndroidTestCase;  import java.util.List; -/** - * Tests for {@link ActivityManager}. - * - * Build/Install/Run: - *  atest WmTests:ActivityManagerTest - */  public class ActivityManagerTest extends AndroidTestCase {      IActivityManager service; diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityRecordTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityRecordTests.java index 616cc0f4007f..5ee1c405bb0e 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityRecordTests.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityRecordTests.java @@ -22,7 +22,11 @@ import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;  import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;  import static android.view.Display.DEFAULT_DISPLAY; +import static com.android.server.am.ActivityStack.ActivityState.DESTROYED; +import static com.android.server.am.ActivityStack.ActivityState.DESTROYING; +import static com.android.server.am.ActivityStack.ActivityState.FINISHING;  import static com.android.server.am.ActivityStack.ActivityState.INITIALIZING; +import static com.android.server.am.ActivityStack.ActivityState.PAUSED;  import static com.android.server.am.ActivityStack.ActivityState.PAUSING;  import static com.android.server.am.ActivityStack.ActivityState.STOPPED;  import static com.android.server.am.ActivityStack.REMOVE_TASK_MODE_MOVING; @@ -53,16 +57,17 @@ import android.support.test.filters.MediumTest;  import android.support.test.runner.AndroidJUnit4;  import android.util.MutableBoolean; +import org.junit.runner.RunWith;  import org.junit.Before; +import org.junit.Ignore;  import org.junit.Test; -import org.junit.runner.RunWith;  import org.mockito.invocation.InvocationOnMock;  /**   * Tests for the {@link ActivityRecord} class.   *   * Build/Install/Run: - *  atest WmTests:com.android.server.am.ActivityRecordTests + *  atest FrameworksServicesTests:com.android.server.am.ActivityRecordTests   */  @MediumTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityStackSupervisorTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityStackSupervisorTests.java index 2209b66e3ed6..1ce41a641935 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityStackSupervisorTests.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityStackSupervisorTests.java @@ -62,7 +62,7 @@ import java.util.ArrayList;   * Tests for the {@link ActivityStackSupervisor} class.   *   * Build/Install/Run: - *  atest WmTests:ActivityStackSupervisorTests + *  atest FrameworksServicesTests:com.android.server.am.ActivityStackSupervisorTests   */  @MediumTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityStackTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java index cac264b81198..01425ed51b55 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityStackTests.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java @@ -33,9 +33,13 @@ import static org.junit.Assert.assertFalse;  import static org.junit.Assert.assertNotNull;  import static org.junit.Assert.assertNull;  import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq;  import static org.mockito.Mockito.anyInt;  import static org.mockito.Mockito.doReturn;  import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify;  import android.content.pm.ActivityInfo;  import android.os.UserHandle; @@ -43,15 +47,15 @@ import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; +import org.junit.runner.RunWith;  import org.junit.Before;  import org.junit.Test; -import org.junit.runner.RunWith;  /**   * Tests for the {@link ActivityStack} class.   *   * Build/Install/Run: - *  atest WmTests:ActivityStackTests + *  atest FrameworksServicesTests:com.android.server.am.ActivityStackTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityStartControllerTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityStartControllerTests.java index 37a5a17caf47..7948e4cfcaaa 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityStartControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityStartControllerTests.java @@ -19,13 +19,6 @@ package com.android.server.am;  import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;  import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -  import android.content.Intent;  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest; @@ -34,8 +27,15 @@ import android.support.test.runner.AndroidJUnit4;  import com.android.server.am.ActivityStackSupervisor.PendingActivityLaunch;  import com.android.server.am.ActivityStarter.Factory; -import org.junit.Test;  import org.junit.runner.RunWith; +import org.junit.Test; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.times;  import java.util.Random; @@ -43,7 +43,7 @@ import java.util.Random;   * Tests for the {@link ActivityStartController} class.   *   * Build/Install/Run: - *  atest WmTests:ActivityStartControllerTests + *  atest FrameworksServicesTests:ActivityStartControllerTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityStartInterceptorTest.java b/services/tests/servicestests/src/com/android/server/am/ActivityStartInterceptorTest.java index 8f2d2844fc9e..b4b34c507942 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityStartInterceptorTest.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityStartInterceptorTest.java @@ -55,7 +55,7 @@ import org.mockito.MockitoAnnotations;   * Unit tests for {@link ActivityStartInterceptorTest}.   *   * Build/Install/Run: - *  bit WmTests:ActivityStartInterceptorTest + *  bit FrameworksServicesTests:com.android.server.am.ActivityStartInterceptorTest   */  @SmallTest  public class ActivityStartInterceptorTest { diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityStarterTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java index 048df43916e0..1520859d4aac 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityStarterTests.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java @@ -32,26 +32,10 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;  import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;  import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;  import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; -import static android.content.Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED; - -import static com.android.server.am.ActivityManagerService.ANIMATE; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyBoolean; -import static org.mockito.Mockito.anyInt; -import static org.mockito.Mockito.anyObject; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify;  import android.app.ActivityOptions;  import android.app.IApplicationThread; +import android.content.ComponentName;  import android.content.Intent;  import android.content.pm.ActivityInfo;  import android.content.pm.ActivityInfo.WindowLayout; @@ -66,18 +50,39 @@ import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4;  import android.view.Gravity; +import org.junit.runner.RunWith; +import org.junit.Test; + +import static android.content.Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED; +import static com.android.server.am.ActivityManagerService.ANIMATE; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyBoolean; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.anyObject; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.times; +  import com.android.internal.os.BatteryStatsImpl; +import com.android.server.am.ActivityStarter.Factory;  import com.android.server.am.LaunchParamsController.LaunchParamsModifier;  import com.android.server.am.TaskRecord.TaskRecordFactory; -import org.junit.Test; -import org.junit.runner.RunWith; +import java.util.ArrayList;  /**   * Tests for the {@link ActivityStarter} class.   *   * Build/Install/Run: - *  atest WmTests:ActivityStarterTests + *  atest FrameworksServicesTests:ActivityStarterTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/ActivityTestsBase.java b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java index d9a346b6c589..1cd111fce0ec 100644 --- a/services/tests/wmtests/src/com/android/server/am/ActivityTestsBase.java +++ b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java @@ -21,17 +21,21 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;  import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;  import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;  import static android.view.Display.DEFAULT_DISPLAY; - +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn;  import static org.mockito.Mockito.any;  import static org.mockito.Mockito.anyBoolean;  import static org.mockito.Mockito.anyInt;  import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock;  import static org.mockito.Mockito.spy;  import android.app.ActivityOptions; +import com.android.server.wm.DisplayWindowController; + +import org.junit.Rule; +import org.mockito.invocation.InvocationOnMock; +  import android.app.IApplicationThread;  import android.content.ComponentName;  import android.content.Context; @@ -48,21 +52,20 @@ import android.service.voice.IVoiceInteractionSession;  import android.support.test.InstrumentationRegistry;  import android.testing.DexmakerShareClassLoaderRule; +  import com.android.internal.app.IVoiceInteractor; +  import com.android.server.AttributeCache;  import com.android.server.wm.AppWindowContainerController; -import com.android.server.wm.DisplayWindowController;  import com.android.server.wm.PinnedStackWindowController;  import com.android.server.wm.StackWindowController;  import com.android.server.wm.TaskWindowContainerController;  import com.android.server.wm.WindowManagerService;  import com.android.server.wm.WindowTestUtils; -  import org.junit.After;  import org.junit.Before; -import org.junit.Rule;  import org.mockito.MockitoAnnotations; -import org.mockito.invocation.InvocationOnMock; +  /**   * A base class to handle common operations in activity related unit tests. diff --git a/services/tests/wmtests/src/com/android/server/am/AppErrorDialogTest.java b/services/tests/servicestests/src/com/android/server/am/AppErrorDialogTest.java index 2289dfc08d0c..3d11c4c84ff1 100644 --- a/services/tests/wmtests/src/com/android/server/am/AppErrorDialogTest.java +++ b/services/tests/servicestests/src/com/android/server/am/AppErrorDialogTest.java @@ -32,10 +32,7 @@ import org.junit.runner.RunWith;  import java.io.File;  /** - * Tests for {@link AppErrorDialog}. - * - * Build/Install/Run: - *  atest WmTests:AppErrorDialogTest + * runtest -c com.android.server.am.AppErrorDialogTest frameworks-services   */  @RunWith(AndroidJUnit4.class)  @SmallTest diff --git a/services/tests/wmtests/src/com/android/server/am/AssistDataRequesterTest.java b/services/tests/servicestests/src/com/android/server/am/AssistDataRequesterTest.java index 285a84f5972b..ce88d849a1d4 100644 --- a/services/tests/wmtests/src/com/android/server/am/AssistDataRequesterTest.java +++ b/services/tests/servicestests/src/com/android/server/am/AssistDataRequesterTest.java @@ -62,8 +62,7 @@ import java.util.concurrent.TimeUnit;   * Note: Currently, we only support fetching the screenshot for the current application, so the   * screenshot checks are hardcoded accordingly.   * - * Build/Install/Run: - *  atest WmTests:AssistDataRequesterTest + * runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/am/AssistDataRequesterTest.java   */  @MediumTest  @RunWith(AndroidJUnit4.class) diff --git a/services/tests/wmtests/src/com/android/server/am/ClientLifecycleManagerTests.java b/services/tests/servicestests/src/com/android/server/am/ClientLifecycleManagerTests.java index 3098db267a74..ef6d5e81b472 100644 --- a/services/tests/wmtests/src/com/android/server/am/ClientLifecycleManagerTests.java +++ b/services/tests/servicestests/src/com/android/server/am/ClientLifecycleManagerTests.java @@ -1,19 +1,3 @@ -/* - * 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.am;  import static org.mockito.Mockito.mock; @@ -31,12 +15,6 @@ import android.support.test.runner.AndroidJUnit4;  import org.junit.Test;  import org.junit.runner.RunWith; -/** - * Test class for {@link ClientLifecycleManager}. - * - * Build/Install/Run: - *  atest WmTests:ClientLifecycleManagerTests - */  @RunWith(AndroidJUnit4.class)  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/CoreSettingsObserverTest.java b/services/tests/servicestests/src/com/android/server/am/CoreSettingsObserverTest.java index adf3f940820a..da30c11be81a 100644 --- a/services/tests/wmtests/src/com/android/server/am/CoreSettingsObserverTest.java +++ b/services/tests/servicestests/src/com/android/server/am/CoreSettingsObserverTest.java @@ -37,6 +37,7 @@ import com.android.server.AppOpsService;  import org.junit.AfterClass;  import org.junit.Before;  import org.junit.BeforeClass; +import org.junit.Ignore;  import org.junit.Test;  import org.junit.runner.RunWith;  import org.mockito.Mock; @@ -47,8 +48,17 @@ import java.io.File;  /**   * Test class for {@link CoreSettingsObserver}.   * - * Build/Install/Run: - *  atest WmTests:CoreSettingsObserverTest + * To run the tests, use + * + * runtest -c com.android.server.am.CoreSettingsObserverTest frameworks-services + * + * or the following steps: + * + * Build: m FrameworksServicesTests + * Install: adb install -r \ + *     ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk + * Run: adb shell am instrument -e class com.android.server.am.CoreSettingsObserverTest -w \ + *     com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner   */  @SmallTest  @RunWith(AndroidJUnit4.class) diff --git a/services/tests/wmtests/src/com/android/server/am/GlobalSettingsToPropertiesMapperTest.java b/services/tests/servicestests/src/com/android/server/am/GlobalSettingsToPropertiesMapperTest.java index b1e0b51366bd..d9b3e1c0173b 100644 --- a/services/tests/wmtests/src/com/android/server/am/GlobalSettingsToPropertiesMapperTest.java +++ b/services/tests/servicestests/src/com/android/server/am/GlobalSettingsToPropertiesMapperTest.java @@ -36,9 +36,6 @@ import java.util.Map;  /**   * Tests for {@link GlobalSettingsToPropertiesMapper} - * - * Build/Install/Run: - *  atest WmTests:GlobalSettingsToPropertiesMapperTest   */  @RunWith(AndroidJUnit4.class)  @SmallTest diff --git a/services/tests/wmtests/src/com/android/server/am/LaunchParamsControllerTests.java b/services/tests/servicestests/src/com/android/server/am/LaunchParamsControllerTests.java index 5f2bc4d3fea4..161c2875bf49 100644 --- a/services/tests/wmtests/src/com/android/server/am/LaunchParamsControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/am/LaunchParamsControllerTests.java @@ -16,14 +16,20 @@  package com.android.server.am; -import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; +import android.app.ActivityOptions; +import android.content.pm.ActivityInfo.WindowLayout; +import android.platform.test.annotations.Presubmit; +import android.support.test.filters.MediumTest; +import android.support.test.runner.AndroidJUnit4; -import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_CONTINUE; -import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_DONE; -import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_SKIP; +import com.android.server.am.LaunchParamsController.LaunchParams; +import org.junit.runner.RunWith; +import org.junit.Before; +import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import com.android.server.am.LaunchParamsController.LaunchParamsModifier; + +import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;  import static org.mockito.Mockito.any;  import static org.mockito.Mockito.anyInt;  import static org.mockito.Mockito.doNothing; @@ -34,24 +40,18 @@ import static org.mockito.Mockito.spy;  import static org.mockito.Mockito.times;  import static org.mockito.Mockito.verify; -import android.app.ActivityOptions; -import android.content.pm.ActivityInfo.WindowLayout; -import android.platform.test.annotations.Presubmit; -import android.support.test.filters.MediumTest; -import android.support.test.runner.AndroidJUnit4; - -import com.android.server.am.LaunchParamsController.LaunchParams; -import com.android.server.am.LaunchParamsController.LaunchParamsModifier; +import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_DONE; +import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_CONTINUE; +import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_SKIP; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals;  /**   * Tests for exercising {@link LaunchParamsController}.   *   * Build/Install/Run: - *  atest WmTests:LaunchParamsControllerTests + *  atest FrameworksServicesTests:LaunchParamsControllerTests   */  @MediumTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/LockTaskControllerTest.java b/services/tests/servicestests/src/com/android/server/am/LockTaskControllerTest.java index a2e976922b7b..f46d712df65b 100644 --- a/services/tests/wmtests/src/com/android/server/am/LockTaskControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/am/LockTaskControllerTest.java @@ -35,20 +35,9 @@ import static android.telecom.TelecomManager.EMERGENCY_DIALER_COMPONENT;  import static com.android.server.am.LockTaskController.STATUS_BAR_MASK_LOCKED;  import static com.android.server.am.LockTaskController.STATUS_BAR_MASK_PINNED; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*;  import android.app.StatusBarManager;  import android.app.admin.DevicePolicyManager; @@ -87,7 +76,7 @@ import org.mockito.verification.VerificationMode;   * Unit tests for {@link LockTaskController}.   *   * Build/Install/Run: - *  bit WmTests:LockTaskControllerTest + *  bit FrameworksServicesTests:com.android.server.am.LockTaskControllerTest   */  @Presubmit  @SmallTest diff --git a/services/tests/wmtests/src/com/android/server/am/MemoryStatUtilTest.java b/services/tests/servicestests/src/com/android/server/am/MemoryStatUtilTest.java index 18b0988f9726..5518ca5bd8cc 100644 --- a/services/tests/wmtests/src/com/android/server/am/MemoryStatUtilTest.java +++ b/services/tests/servicestests/src/com/android/server/am/MemoryStatUtilTest.java @@ -16,9 +16,9 @@  package com.android.server.am; -import static com.android.server.am.MemoryStatUtil.MemoryStat;  import static com.android.server.am.MemoryStatUtil.parseMemoryStatFromMemcg;  import static com.android.server.am.MemoryStatUtil.parseMemoryStatFromProcfs; +import static com.android.server.am.MemoryStatUtil.MemoryStat;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertNull; @@ -29,12 +29,6 @@ import android.support.test.runner.AndroidJUnit4;  import org.junit.Test;  import org.junit.runner.RunWith; -/** - * Tests for {@link MemoryStatUtil}. - * - * Build/Install/Run: - *  atest WmTests:MemoryStatUtilTest - */  @RunWith(AndroidJUnit4.class)  @SmallTest  public class MemoryStatUtilTest { diff --git a/services/tests/wmtests/src/com/android/server/am/PendingRemoteAnimationRegistryTest.java b/services/tests/servicestests/src/com/android/server/am/PendingRemoteAnimationRegistryTest.java index f812ee6f1fda..2baf9952cb9e 100644 --- a/services/tests/wmtests/src/com/android/server/am/PendingRemoteAnimationRegistryTest.java +++ b/services/tests/servicestests/src/com/android/server/am/PendingRemoteAnimationRegistryTest.java @@ -20,11 +20,14 @@ import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertNotNull;  import static org.junit.Assert.assertNull; +import android.annotation.Nullable;  import android.app.ActivityOptions; +import android.os.Handler;  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.FlakyTest;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; +import android.util.ArrayMap;  import android.view.RemoteAnimationAdapter;  import com.android.server.testutils.OffsettableClock; @@ -37,10 +40,7 @@ import org.mockito.Mock;  import org.mockito.MockitoAnnotations;  /** - * Tests for {@link PendingRemoteAnimationRegistry}. - * - * Build/Install/Run: - *  atest WmTests:PendingRemoteAnimationRegistryTest + * atest PendingRemoteAnimationRegistryTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/PersistentConnectionTest.java b/services/tests/servicestests/src/com/android/server/am/PersistentConnectionTest.java index 5c42081d4655..54f93a88a387 100644 --- a/services/tests/wmtests/src/com/android/server/am/PersistentConnectionTest.java +++ b/services/tests/servicestests/src/com/android/server/am/PersistentConnectionTest.java @@ -13,7 +13,6 @@   * See the License for the specific language governing permissions and   * limitations under the License.   */ -  package com.android.server.am;  import static org.mockito.ArgumentMatchers.any; @@ -42,12 +41,6 @@ import java.util.ArrayList;  import java.util.Arrays;  import java.util.Collections; -/** - * Tests for {@link PersistentConnection}. - * - * Build/Install/Run: - *  atest WmTests:PersistentConnectionTest - */  @SmallTest  public class PersistentConnectionTest extends AndroidTestCase {      private static class MyConnection extends PersistentConnection<IDeviceAdminService> { diff --git a/services/tests/wmtests/src/com/android/server/am/RecentTasksTest.java b/services/tests/servicestests/src/com/android/server/am/RecentTasksTest.java index 739467a48d16..b73ac8934cb0 100644 --- a/services/tests/wmtests/src/com/android/server/am/RecentTasksTest.java +++ b/services/tests/servicestests/src/com/android/server/am/RecentTasksTest.java @@ -35,12 +35,16 @@ import static org.junit.Assert.fail;  import static org.mockito.ArgumentMatchers.anyInt;  import static org.mockito.ArgumentMatchers.anyString;  import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy;  import static java.lang.Integer.MAX_VALUE; +import android.annotation.TestApi;  import android.app.ActivityManager;  import android.app.ActivityManager.RecentTaskInfo;  import android.app.ActivityManager.RunningTaskInfo; +import android.app.WindowConfiguration;  import android.content.ComponentName;  import android.content.Context;  import android.content.pm.PackageManager; @@ -49,6 +53,7 @@ import android.content.pm.UserInfo;  import android.content.res.Configuration;  import android.graphics.Rect;  import android.os.Bundle; +import android.os.Debug;  import android.os.Looper;  import android.os.RemoteException;  import android.os.SystemClock; @@ -75,10 +80,7 @@ import java.util.Random;  import java.util.Set;  /** - * Tests for {@link RecentTasks}. - * - * Build/Install/Run: - *  atest WmTests:RecentTasksTest + * atest FrameworksServicesTests:RecentTasksTest   */  @MediumTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/RecentsAnimationTest.java b/services/tests/servicestests/src/com/android/server/am/RecentsAnimationTest.java index ee576e310982..eefd973112f5 100644 --- a/services/tests/wmtests/src/com/android/server/am/RecentsAnimationTest.java +++ b/services/tests/servicestests/src/com/android/server/am/RecentsAnimationTest.java @@ -16,13 +16,15 @@  package com.android.server.am; +import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;  import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;  import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;  import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; - +import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK; +import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;  import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_PLACE; -  import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyInt;  import static org.mockito.Mockito.doReturn;  import static org.mockito.Mockito.eq;  import static org.mockito.Mockito.mock; @@ -37,18 +39,13 @@ import android.support.test.InstrumentationRegistry;  import android.support.test.filters.MediumTest;  import android.support.test.runner.AndroidJUnit4;  import android.view.IRecentsAnimationRunner; -  import com.android.server.AttributeCache; -  import org.junit.Before;  import org.junit.Test;  import org.junit.runner.RunWith;  /** - * Tests for {@link RecentsAnimation}. - * - * Build/Install/Run: - *  atest WmTests:RecentsAnimationTest + * atest FrameworksServicesTests:RecentsAnimationTest   */  @MediumTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/RunningTasksTest.java b/services/tests/servicestests/src/com/android/server/am/RunningTasksTest.java index 4e5fbd8f8279..c6ce7e1188e8 100644 --- a/services/tests/wmtests/src/com/android/server/am/RunningTasksTest.java +++ b/services/tests/servicestests/src/com/android/server/am/RunningTasksTest.java @@ -41,11 +41,8 @@ import org.junit.runner.RunWith;  import java.util.ArrayList; - /** - * Tests for {@link RunningTasks}. - * - * Build/Install/Run: - *  atest WmTests:RunningTasksTest +/** + * runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/am/RunningTasksTest.java   */  @MediumTest  @Presubmit @@ -126,4 +123,4 @@ public class RunningTasksTest extends ActivityTestsBase {                  .build();          return task;      } -} +}
\ No newline at end of file diff --git a/services/tests/wmtests/src/com/android/server/am/SafeActivityOptionsTest.java b/services/tests/servicestests/src/com/android/server/am/SafeActivityOptionsTest.java index 3f05c8c7e9f5..168bc1782d56 100644 --- a/services/tests/wmtests/src/com/android/server/am/SafeActivityOptionsTest.java +++ b/services/tests/servicestests/src/com/android/server/am/SafeActivityOptionsTest.java @@ -27,12 +27,6 @@ import android.support.test.runner.AndroidJUnit4;  import org.junit.Test;  import org.junit.runner.RunWith; -/** - * Tests for {@link SafeActivityOptions}. - * - * Build/Install/Run: - *  atest WmTests:SafeActivityOptionsTest - */  @MediumTest  @Presubmit  @FlakyTest diff --git a/services/tests/wmtests/src/com/android/server/am/TaskLaunchParamsModifierTests.java b/services/tests/servicestests/src/com/android/server/am/TaskLaunchParamsModifierTests.java index 7fb63d3d4355..3d323f0eb783 100644 --- a/services/tests/wmtests/src/com/android/server/am/TaskLaunchParamsModifierTests.java +++ b/services/tests/servicestests/src/com/android/server/am/TaskLaunchParamsModifierTests.java @@ -16,29 +16,37 @@  package com.android.server.am; -import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; -import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; - -import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_CONTINUE; - -import static org.junit.Assert.assertEquals; -  import android.content.pm.ActivityInfo.WindowLayout;  import android.graphics.Rect;  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.MediumTest;  import android.support.test.runner.AndroidJUnit4; +  import android.view.Gravity; +import org.junit.runner.RunWith;  import org.junit.Before;  import org.junit.Test; -import org.junit.runner.RunWith; + +import org.mockito.invocation.InvocationOnMock; + +import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; +import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; + +import static com.android.server.am.LaunchParamsController.LaunchParamsModifier.RESULT_CONTINUE; + +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.doAnswer; +import static org.junit.Assert.assertEquals; +  /**   * Tests for exercising resizing task bounds.   *   * Build/Install/Run: - *  atest WmTests:TaskLaunchParamsModifierTests + *  atest FrameworksServicesTests:TaskLaunchParamsModifierTests   */  @MediumTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/TaskPersisterTest.java b/services/tests/servicestests/src/com/android/server/am/TaskPersisterTest.java index cdafb5258a34..9e6055d55e0f 100644 --- a/services/tests/wmtests/src/com/android/server/am/TaskPersisterTest.java +++ b/services/tests/servicestests/src/com/android/server/am/TaskPersisterTest.java @@ -17,16 +17,20 @@  package com.android.server.am;  import android.content.pm.UserInfo; +import android.os.Environment;  import android.os.UserHandle;  import android.os.UserManager;  import android.test.AndroidTestCase; +import android.util.Log;  import android.util.SparseBooleanArray; +import com.android.server.am.TaskPersister; + +import java.io.File; +import java.util.Random; +  /** - * Tests for {@link TaskPersister}. - * - * Build/Install/Run: - *  atest WmTests:TaskPersisterTest + * atest FrameworksServicesTests:TaskPersisterTest   */  public class TaskPersisterTest extends AndroidTestCase {      private static final String TEST_USER_NAME = "AM-Test-User"; diff --git a/services/tests/wmtests/src/com/android/server/am/TaskRecordTests.java b/services/tests/servicestests/src/com/android/server/am/TaskRecordTests.java index dbb3e7ee4183..057fdc8c10bb 100644 --- a/services/tests/wmtests/src/com/android/server/am/TaskRecordTests.java +++ b/services/tests/servicestests/src/com/android/server/am/TaskRecordTests.java @@ -29,16 +29,20 @@ import android.app.ActivityManager;  import android.content.ComponentName;  import android.content.Intent;  import android.content.pm.ActivityInfo; +import android.content.res.XmlResourceParser;  import android.graphics.Rect;  import android.platform.test.annotations.Presubmit;  import android.service.voice.IVoiceInteractionSession; +import android.support.test.InstrumentationRegistry;  import android.support.test.filters.MediumTest;  import android.support.test.runner.AndroidJUnit4;  import android.util.Xml; +import com.android.frameworks.servicestests.R;  import com.android.internal.app.IVoiceInteractor;  import com.android.server.am.TaskRecord.TaskRecordFactory; +import org.junit.After;  import org.junit.Before;  import org.junit.Test;  import org.junit.runner.RunWith; @@ -53,13 +57,15 @@ import java.io.FileReader;  import java.io.IOException;  import java.io.OutputStream;  import java.io.Reader; +import java.nio.file.Files;  import java.util.ArrayList; +import java.util.Comparator;  /**   * Tests for exercising {@link TaskRecord}.   *   * Build/Install/Run: - *  atest WmTests:TaskRecordTests + *  atest FrameworksServicesTests:com.android.server.am.TaskRecordTests   */  @MediumTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/am/TaskStackChangedListenerTest.java b/services/tests/servicestests/src/com/android/server/am/TaskStackChangedListenerTest.java index 28689cb701c9..0359096892bb 100644 --- a/services/tests/wmtests/src/com/android/server/am/TaskStackChangedListenerTest.java +++ b/services/tests/servicestests/src/com/android/server/am/TaskStackChangedListenerTest.java @@ -17,7 +17,6 @@  package com.android.server.am;  import static android.support.test.InstrumentationRegistry.getInstrumentation; -  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse;  import static org.junit.Assert.assertTrue; @@ -33,30 +32,23 @@ import android.content.ComponentName;  import android.content.Context;  import android.content.Intent;  import android.content.pm.ActivityInfo; +import android.content.res.Resources.Theme;  import android.os.RemoteException;  import android.support.test.InstrumentationRegistry;  import android.support.test.filters.MediumTest;  import android.support.test.runner.AndroidJUnit4;  import android.support.test.uiautomator.UiDevice;  import android.text.TextUtils; - +import android.util.Pair;  import com.android.internal.annotations.GuardedBy; - +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit;  import org.junit.After;  import org.junit.Assert;  import org.junit.Before;  import org.junit.Test;  import org.junit.runner.RunWith; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -/** - * Tests for {@link TaskStackListener}. - * - * Build/Install/Run: - *  atest WmTests:TaskStackChangedListenerTest - */  @MediumTest  @RunWith(AndroidJUnit4.class)  public class TaskStackChangedListenerTest { diff --git a/services/tests/wmtests/src/com/android/server/am/UserControllerTest.java b/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java index fb5ded51489f..cc4f51987523 100644 --- a/services/tests/wmtests/src/com/android/server/am/UserControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java @@ -16,30 +16,6 @@  package com.android.server.am; -import static android.content.pm.PackageManager.PERMISSION_GRANTED; -import static android.testing.DexmakerShareClassLoaderRule.runWithDexmakerShareClassLoader; - -import static com.android.server.am.UserController.CONTINUE_USER_SWITCH_MSG; -import static com.android.server.am.UserController.REPORT_LOCKED_BOOT_COMPLETE_MSG; -import static com.android.server.am.UserController.REPORT_USER_SWITCH_COMPLETE_MSG; -import static com.android.server.am.UserController.REPORT_USER_SWITCH_MSG; -import static com.android.server.am.UserController.SYSTEM_USER_CURRENT_MSG; -import static com.android.server.am.UserController.SYSTEM_USER_START_MSG; -import static com.android.server.am.UserController.USER_SWITCH_TIMEOUT_MSG; - -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; -  import android.app.IUserSwitchObserver;  import android.content.Context;  import android.content.IIntentReceiver; @@ -72,11 +48,30 @@ import java.util.LinkedHashSet;  import java.util.List;  import java.util.Set; +import static android.content.pm.PackageManager.PERMISSION_GRANTED; +import static android.testing.DexmakerShareClassLoaderRule.runWithDexmakerShareClassLoader; +import static com.android.server.am.UserController.CONTINUE_USER_SWITCH_MSG; +import static com.android.server.am.UserController.REPORT_LOCKED_BOOT_COMPLETE_MSG; +import static com.android.server.am.UserController.REPORT_USER_SWITCH_COMPLETE_MSG; +import static com.android.server.am.UserController.REPORT_USER_SWITCH_MSG; +import static com.android.server.am.UserController.SYSTEM_USER_CURRENT_MSG; +import static com.android.server.am.UserController.SYSTEM_USER_START_MSG; +import static com.android.server.am.UserController.USER_SWITCH_TIMEOUT_MSG; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; +  /** - * Tests for {@link UserController}. - * - * Build/Install/Run: - *  atest WmTests:UserControllerTest + * Usage: bit FrameworksServicesTests:com.android.server.am.UserControllerTest   */  @Presubmit  public class UserControllerTest extends AndroidTestCase { diff --git a/services/tests/wmtests/src/com/android/server/policy/FakeWindowState.java b/services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java index 7487d4490d9a..7487d4490d9a 100644 --- a/services/tests/wmtests/src/com/android/server/policy/FakeWindowState.java +++ b/services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java diff --git a/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerInsetsTest.java b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerInsetsTest.java index 7e18ce78c9d1..7e18ce78c9d1 100644 --- a/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerInsetsTest.java +++ b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerInsetsTest.java diff --git a/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java index 97a716f6bd99..97a716f6bd99 100644 --- a/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java +++ b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java diff --git a/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerTest.java b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerTest.java index 30665b56c8dc..30665b56c8dc 100644 --- a/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerTest.java diff --git a/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerTestBase.java b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerTestBase.java index 2c47a9432eff..2c47a9432eff 100644 --- a/services/tests/wmtests/src/com/android/server/policy/PhoneWindowManagerTestBase.java +++ b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerTestBase.java diff --git a/services/tests/wmtests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java b/services/tests/servicestests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java index a396946db247..164c80b2427a 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java @@ -18,10 +18,13 @@ package com.android.server.wm;  import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;  import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; - +import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; +import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;  import static junit.framework.Assert.assertFalse;  import static junit.framework.Assert.assertTrue; - +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.ArgumentMatchers.any;  import static org.mockito.Mockito.verify;  import static org.mockito.Mockito.verifyZeroInteractions; @@ -30,9 +33,12 @@ import android.support.test.filters.FlakyTest;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; +import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback; +  import org.junit.Before;  import org.junit.Test;  import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor;  import org.mockito.Mock;  import org.mockito.MockitoAnnotations; @@ -40,7 +46,7 @@ import org.mockito.MockitoAnnotations;   * Tests for the {@link TaskStack} class.   *   * Build/Install/Run: - *  atest WmTests:AnimatingAppWindowTokenRegistryTest + *  atest FrameworksServicesTests:com.android.server.wm.AnimatingAppWindowTokenRegistryTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java b/services/tests/servicestests/src/com/android/server/wm/AppTransitionTests.java index 6b3266d2f0a0..be7d781799fa 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/AppTransitionTests.java @@ -20,7 +20,6 @@ import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;  import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE;  import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;  import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; -  import static org.junit.Assert.assertEquals;  import android.content.Context; @@ -37,8 +36,7 @@ import org.junit.runner.RunWith;  /**   * Test class for {@link AppTransition}.   * - * Build/Install/Run: - *  atest WmTests:AppTransitionTests + * atest AppTransitionTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowContainerControllerTests.java b/services/tests/servicestests/src/com/android/server/wm/AppWindowContainerControllerTests.java index 09a084737def..e0645b1f4bfb 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppWindowContainerControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/AppWindowContainerControllerTests.java @@ -16,32 +16,30 @@  package com.android.server.wm; +import android.support.test.filters.FlakyTest; +import org.junit.Test; + +import android.platform.test.annotations.Presubmit; +import android.support.test.InstrumentationRegistry; +import android.support.test.filters.SmallTest; +import android.support.test.runner.AndroidJUnit4; +  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;  import static android.content.res.Configuration.EMPTY;  import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; -  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse;  import static org.junit.Assert.assertNotNull;  import static org.junit.Assert.assertNull;  import static org.junit.Assert.fail; -import android.platform.test.annotations.Presubmit; -import android.support.test.InstrumentationRegistry; -import android.support.test.filters.FlakyTest; -import android.support.test.filters.SmallTest; -import android.support.test.runner.AndroidJUnit4; -  import com.android.server.wm.WindowTestUtils.TestTaskWindowContainerController; -import org.junit.Test; -  /**   * Test class for {@link AppWindowContainerController}.   * - * Build/Install/Run: - *  atest WmTests:AppWindowContainerControllerTests + * atest FrameworksServicesTests:com.android.server.wm.AppWindowContainerControllerTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/servicestests/src/com/android/server/wm/AppWindowTokenTests.java index 8dedb584ae59..f6599dcaf87e 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/AppWindowTokenTests.java @@ -16,6 +16,16 @@  package com.android.server.wm; +import org.junit.Test; +import org.junit.runner.RunWith; + +import android.platform.test.annotations.Presubmit; +import android.support.test.filters.FlakyTest; +import android.support.test.filters.SmallTest; +import android.support.test.runner.AndroidJUnit4; +import android.view.Surface; +import android.view.WindowManager; +  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; @@ -28,27 +38,15 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;  import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;  import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;  import static android.view.WindowManager.TRANSIT_UNSET; -  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse;  import static org.junit.Assert.assertNull;  import static org.junit.Assert.assertTrue; - -import android.platform.test.annotations.Presubmit; -import android.support.test.filters.FlakyTest; -import android.support.test.filters.SmallTest; -import android.support.test.runner.AndroidJUnit4; -import android.view.Surface; -import android.view.WindowManager; - -import org.junit.Test; -import org.junit.runner.RunWith; -  /**   * Tests for the {@link AppWindowToken} class.   *   * Build/Install/Run: - *  atest WmTests:AppWindowTokenTests + *  atest FrameworksServicesTests:com.android.server.wm.AppWindowTokenTests   */  @SmallTest  // TODO: b/68267650 diff --git a/services/tests/wmtests/src/com/android/server/wm/BoundsAnimationControllerTests.java b/services/tests/servicestests/src/com/android/server/wm/BoundsAnimationControllerTests.java index 7fbb4ee3b0b4..ff631e74e004 100644 --- a/services/tests/wmtests/src/com/android/server/wm/BoundsAnimationControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/BoundsAnimationControllerTests.java @@ -21,12 +21,6 @@ import static com.android.server.wm.BoundsAnimationController.SCHEDULE_PIP_MODE_  import static com.android.server.wm.BoundsAnimationController.SCHEDULE_PIP_MODE_CHANGED_ON_START;  import static com.android.server.wm.BoundsAnimationController.SchedulePipModeChangedState; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -  import android.animation.ValueAnimator;  import android.content.Context;  import android.graphics.Rect; @@ -38,12 +32,23 @@ import android.support.test.annotation.UiThreadTest;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; -import com.android.server.wm.BoundsAnimationController.BoundsAnimator;  import com.android.server.wm.WindowManagerInternal.AppTransitionListener;  import org.junit.Test;  import org.junit.runner.RunWith; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import com.android.server.wm.BoundsAnimationController.BoundsAnimator; +  /**   * Test class for {@link BoundsAnimationController} to ensure that it sends the right callbacks   * depending on the various interactions. @@ -55,7 +60,7 @@ import org.junit.runner.RunWith;   * appropriately.   *   * Build/Install/Run: - *  bit WmTests:BoundsAnimationControllerTests + *  bit FrameworksServicesTests:com.android.server.wm.BoundsAnimationControllerTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/ConfigurationContainerTests.java b/services/tests/servicestests/src/com/android/server/wm/ConfigurationContainerTests.java index 6a6f9543842f..192e1564ae8d 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ConfigurationContainerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/ConfigurationContainerTests.java @@ -17,6 +17,7 @@  package com.android.server.wm;  import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; +import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;  import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;  import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;  import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; @@ -27,7 +28,6 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;  import static android.content.res.Configuration.EMPTY; -  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertTrue; @@ -35,7 +35,6 @@ import android.content.res.Configuration;  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; -  import org.junit.Test;  import org.junit.runner.RunWith; @@ -46,7 +45,7 @@ import java.util.List;   * Test class for {@link ConfigurationContainer}.   *   * Build/Install/Run: - *  atest WmTests:ConfigurationContainerTests + *  bit FrameworksServicesTests:com.android.server.wm.ConfigurationContainerTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java b/services/tests/servicestests/src/com/android/server/wm/DimmerTests.java index a12a802f0920..6769e40dca78 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/DimmerTests.java @@ -38,10 +38,8 @@ import org.junit.Test;  import org.junit.runner.RunWith;  /** - * Tests for {@link Dimmer}. - *   * Build/Install/Run: - *  atest WmTests:DimmerTests; + * atest FrameworksServicesTests:com.android.server.wm.DimmerTests;   */  @Presubmit  @RunWith(AndroidJUnit4.class) diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/servicestests/src/com/android/server/wm/DisplayContentTests.java index a9744ea2dc1a..ac196f9c80dc 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/DisplayContentTests.java @@ -28,7 +28,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_  import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;  import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;  import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION; -  import static com.android.server.wm.WindowContainer.POSITION_TOP;  import static org.hamcrest.Matchers.is; @@ -39,6 +38,9 @@ import static org.junit.Assert.assertTrue;  import static org.mockito.Mockito.times;  import static org.mockito.Mockito.verify; +import org.junit.Test; +import org.junit.runner.RunWith; +  import android.annotation.SuppressLint;  import android.content.res.Configuration;  import android.graphics.Rect; @@ -55,9 +57,6 @@ import android.view.Surface;  import com.android.server.wm.utils.WmDisplayCutout; -import org.junit.Test; -import org.junit.runner.RunWith; -  import java.util.ArrayList;  import java.util.Arrays;  import java.util.Collections; @@ -68,7 +67,7 @@ import java.util.List;   * Tests for the {@link DisplayContent} class.   *   * Build/Install/Run: - *  atest WmTests:DisplayContentTests + *  atest com.android.server.wm.DisplayContentTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/DragDropControllerTests.java b/services/tests/servicestests/src/com/android/server/wm/DragDropControllerTests.java index 68b09982be98..a09656c7dc92 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DragDropControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/DragDropControllerTests.java @@ -19,7 +19,6 @@ package com.android.server.wm;  import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;  import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;  import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; -  import static org.junit.Assert.assertNotNull;  import static org.junit.Assert.assertTrue;  import static org.mockito.Mockito.any; @@ -40,23 +39,19 @@ import android.view.InputChannel;  import android.view.SurfaceControl;  import android.view.SurfaceSession;  import android.view.View; -  import com.android.internal.annotations.GuardedBy;  import com.android.server.LocalServices; - +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit;  import org.junit.After;  import org.junit.Before;  import org.junit.Test;  import org.junit.runner.RunWith; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -  /**   * Tests for the {@link DragDropController} class.   * - * Build/Install/Run: - *  atest WmTests:DragDropControllerTests + * atest com.android.server.wm.DragDropControllerTests   */  @SmallTest  @RunWith(AndroidJUnit4.class) diff --git a/services/tests/wmtests/src/com/android/server/wm/PinnedStackControllerTest.java b/services/tests/servicestests/src/com/android/server/wm/PinnedStackControllerTest.java index f0faf28fd129..96745fa5956e 100644 --- a/services/tests/wmtests/src/com/android/server/wm/PinnedStackControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/PinnedStackControllerTest.java @@ -2,15 +2,6 @@ package com.android.server.wm;  import static android.view.Display.DEFAULT_DISPLAY; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -  import android.os.RemoteException;  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest; @@ -23,12 +14,15 @@ import org.junit.runner.RunWith;  import org.mockito.Mock;  import org.mockito.MockitoAnnotations; -/** - * Tests for {@link PinnedStackController}. - * - * Build/Install/Run: - *  atest WmTests:PinnedStackControllerTest - */ +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +  @SmallTest  @Presubmit  @RunWith(AndroidJUnit4.class) diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/servicestests/src/com/android/server/wm/RecentsAnimationControllerTest.java index fdebaa6df18c..a2af9b80fe36 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/RecentsAnimationControllerTest.java @@ -19,10 +19,8 @@ package com.android.server.wm;  import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;  import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;  import static android.view.Display.DEFAULT_DISPLAY; -  import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_PLACE;  import static com.android.server.wm.RecentsAnimationController.REORDER_MOVE_TO_ORIGINAL_POSITION; -  import static org.junit.Assert.fail;  import static org.mockito.ArgumentMatchers.eq;  import static org.mockito.Mockito.atLeast; @@ -37,9 +35,7 @@ import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4;  import android.view.IRecentsAnimationRunner;  import android.view.SurfaceControl; -  import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback; -  import org.junit.Before;  import org.junit.Test;  import org.junit.runner.RunWith; @@ -47,10 +43,7 @@ import org.mockito.Mock;  import org.mockito.MockitoAnnotations;  /** - * Tests for {@link RecentsAnimationController}. - * - * Build/Install/Run: - *  atest WmTests:RecentsAnimationControllerTest + * atest FrameworksServicesTests:com.android.server.wm.RecentsAnimationControllerTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java b/services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java index 383e53fafeea..95361f03fe4b 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java @@ -31,6 +31,7 @@ import android.graphics.Rect;  import android.os.Binder;  import android.os.IInterface;  import android.platform.test.annotations.Presubmit; +import android.support.test.filters.FlakyTest;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4;  import android.view.IRemoteAnimationFinishedCallback; @@ -52,10 +53,7 @@ import org.mockito.Mock;  import org.mockito.MockitoAnnotations;  /** - * Tests for {@link RemoteAnimationController}. - * - * Build/Install/Run: - *  atest WmTests:RemoteAnimationControllerTest + * atest FrameworksServicesTests:com.android.server.wm.RemoteAnimationControllerTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/RootWindowContainerTests.java b/services/tests/servicestests/src/com/android/server/wm/RootWindowContainerTests.java index 317f36cc2077..204e26cee532 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RootWindowContainerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/RootWindowContainerTests.java @@ -1,21 +1,22 @@  package com.android.server.wm; -import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.junit.runner.RunWith;  import android.content.res.Configuration;  import android.graphics.Rect; +  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; -import org.junit.Test; -import org.junit.runner.RunWith; +import static org.junit.Assert.assertTrue;  /**   * Tests for the {@link RootWindowContainer} class.   *   * Build/Install/Run: - *  atest WmTests:RootWindowContainerTests + *  atest FrameworksServicesTests:com.android.server.wm.RootWindowContainerTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/ScreenDecorWindowTests.java b/services/tests/servicestests/src/com/android/server/wm/ScreenDecorWindowTests.java index 7e7cfed991ba..a2ccee46e0c9 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ScreenDecorWindowTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/ScreenDecorWindowTests.java @@ -32,7 +32,6 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;  import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;  import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_SCREEN_DECOR;  import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; -  import static org.junit.Assert.assertEquals;  import android.app.Activity; @@ -71,7 +70,7 @@ import java.util.function.BooleanSupplier;   * Tests for the {@link android.view.WindowManager.LayoutParams#PRIVATE_FLAG_IS_SCREEN_DECOR} flag.   *   * Build/Install/Run: - *  atest WmTests:ScreenDecorWindowTests + *  atest FrameworksServicesTests:com.android.server.wm.ScreenDecorWindowTests   */  // TODO: Add test for FLAG_FULLSCREEN which hides the status bar and also other flags.  // TODO: Test non-Activity windows. diff --git a/services/tests/wmtests/src/com/android/server/wm/StackWindowControllerTests.java b/services/tests/servicestests/src/com/android/server/wm/StackWindowControllerTests.java index fb2986c0212d..ab0a2bd86dd8 100644 --- a/services/tests/wmtests/src/com/android/server/wm/StackWindowControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/StackWindowControllerTests.java @@ -16,24 +16,25 @@  package com.android.server.wm; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -  import android.graphics.Rect; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; -import org.junit.Test; -import org.junit.runner.RunWith; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue;  /**   * Test class for {@link StackWindowController}.   *   * Build/Install/Run: - *  atest WmTests:StackWindowControllerTests + *  atest FrameworksServicesTests:StackWindowControllerTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java b/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java index 9ea370284fc2..edac8a5202d7 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java @@ -16,6 +16,7 @@  package com.android.server.wm; +import static java.util.concurrent.TimeUnit.SECONDS;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse;  import static org.junit.Assert.assertTrue; @@ -23,11 +24,11 @@ import static org.mockito.Mockito.any;  import static org.mockito.Mockito.atLeast;  import static org.mockito.Mockito.atLeastOnce;  import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.times;  import static org.mockito.Mockito.verify;  import static org.mockito.Mockito.when; -import static java.util.concurrent.TimeUnit.SECONDS; - +import android.animation.AnimationHandler;  import android.animation.AnimationHandler.AnimationFrameCallbackProvider;  import android.animation.ValueAnimator;  import android.graphics.Matrix; @@ -36,6 +37,7 @@ import android.platform.test.annotations.Presubmit;  import android.support.test.filters.FlakyTest;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; +import android.util.Log;  import android.view.Choreographer;  import android.view.Choreographer.FrameCallback;  import android.view.SurfaceControl; @@ -44,6 +46,7 @@ import android.view.animation.Animation;  import android.view.animation.TranslateAnimation;  import com.android.server.wm.LocalAnimationAdapter.AnimationSpec; +import com.android.server.wm.SurfaceAnimationRunner.AnimatorFactory;  import org.junit.Before;  import org.junit.Rule; @@ -58,8 +61,7 @@ import java.util.concurrent.CountDownLatch;  /**   * Test class for {@link SurfaceAnimationRunner}.   * - * Build/Install/Run: - *  atest WmTests:SurfaceAnimationRunnerTest + * atest FrameworksServicesTests:com.android.server.wm.SurfaceAnimationRunnerTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimatorTest.java b/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java index 66f4b194a5ac..16b84581de39 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimatorTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java @@ -46,11 +46,12 @@ import org.mockito.ArgumentCaptor;  import org.mockito.Mock;  import org.mockito.MockitoAnnotations; +import java.util.ArrayList; +  /**   * Test class for {@link SurfaceAnimatorTest}.   * - * Build/Install/Run: - *  atest WmTests:SurfaceAnimatorTest + * atest FrameworksServicesTests:com.android.server.wm.SurfaceAnimatorTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskPositionerTests.java b/services/tests/servicestests/src/com/android/server/wm/TaskPositionerTests.java index ae730895f5d7..7bf7dd78711c 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskPositionerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/TaskPositionerTests.java @@ -16,14 +16,10 @@  package com.android.server.wm; -import static com.android.server.wm.TaskPositioner.MIN_ASPECT; -import static com.android.server.wm.WindowManagerService.dipToPixel; -import static com.android.server.wm.WindowState.MINIMUM_VISIBLE_HEIGHT_IN_DP; -import static com.android.server.wm.WindowState.MINIMUM_VISIBLE_WIDTH_IN_DP; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith;  import android.graphics.Rect;  import android.support.test.filters.SmallTest; @@ -32,16 +28,18 @@ import android.util.DisplayMetrics;  import android.util.Log;  import android.view.Display; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import static com.android.server.wm.TaskPositioner.MIN_ASPECT; +import static com.android.server.wm.WindowManagerService.dipToPixel; +import static com.android.server.wm.WindowState.MINIMUM_VISIBLE_HEIGHT_IN_DP; +import static com.android.server.wm.WindowState.MINIMUM_VISIBLE_WIDTH_IN_DP; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue;  /**   * Tests for the {@link TaskPositioner} class.   * - * Build/Install/Run: - *  atest WmTests:TaskPositionerTests + * runtest frameworks-services -c com.android.server.wm.TaskPositionerTests   */  @SmallTest  @RunWith(AndroidJUnit4.class) diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskPositioningControllerTests.java b/services/tests/servicestests/src/com/android/server/wm/TaskPositioningControllerTests.java index 659ec41c30c4..6070516669b5 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskPositioningControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/TaskPositioningControllerTests.java @@ -17,7 +17,6 @@  package com.android.server.wm;  import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; -  import static org.junit.Assert.assertFalse;  import static org.junit.Assert.assertNotNull;  import static org.junit.Assert.assertNull; @@ -31,7 +30,6 @@ import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4;  import android.view.InputChannel; -  import org.junit.Before;  import org.junit.Test;  import org.junit.runner.RunWith; @@ -39,8 +37,7 @@ import org.junit.runner.RunWith;  /**   * Tests for the {@link TaskPositioningController} class.   * - * Build/Install/Run: - *  atest WmTests:TaskPositioningControllerTests + * atest com.android.server.wm.TaskPositioningControllerTests   */  @SmallTest  @RunWith(AndroidJUnit4.class) diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotCacheTest.java b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotCacheTest.java index 1aefa277e84f..649de4a783fa 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotCacheTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotCacheTest.java @@ -17,7 +17,6 @@  package com.android.server.wm;  import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW; -  import static junit.framework.Assert.assertNotNull;  import static junit.framework.Assert.assertNull; @@ -32,8 +31,7 @@ import org.junit.runner.RunWith;  /**   * Test class for {@link TaskSnapshotCache}.   * - * Build/Install/Run: - *  atest WmTests:TaskSnapshotCacheTest + * runtest frameworks-services -c com.android.server.wm.TaskSnapshotCacheTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotControllerTest.java index 77521a652ca3..5650050f0420 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotControllerTest.java @@ -19,11 +19,10 @@ package com.android.server.wm;  import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;  import static android.view.WindowManager.LayoutParams.FLAG_SECURE;  import static android.view.WindowManager.TRANSIT_UNSET; - -import static com.android.server.wm.TaskSnapshotController.SNAPSHOT_MODE_APP_THEME; -import static com.android.server.wm.TaskSnapshotController.SNAPSHOT_MODE_REAL; - +import static com.android.server.wm.TaskSnapshotController.*;  import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertFalse; +import static junit.framework.Assert.assertTrue;  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest; @@ -31,15 +30,13 @@ import android.support.test.runner.AndroidJUnit4;  import android.util.ArraySet;  import com.google.android.collect.Sets; -  import org.junit.Test;  import org.junit.runner.RunWith;  /**   * Test class for {@link TaskSnapshotController}.   * - * Build/Install/Run: - *  atest WmTests:TaskSnapshotControllerTest + * runtest frameworks-services -c com.android.server.wm.TaskSnapshotControllerTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java index ed81dafe3205..325d42aa6293 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java @@ -18,12 +18,12 @@ package com.android.server.wm;  import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;  import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; -  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse;  import static org.junit.Assert.assertNotNull;  import static org.junit.Assert.assertNull;  import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail;  import android.app.ActivityManager.TaskSnapshot;  import android.content.res.Configuration; @@ -33,8 +33,8 @@ import android.platform.test.annotations.Presubmit;  import android.support.test.filters.MediumTest;  import android.support.test.runner.AndroidJUnit4;  import android.util.ArraySet; -import android.view.View; +import android.view.View;  import com.android.server.wm.TaskSnapshotPersister.RemoveObsoleteFilesQueueItem;  import org.junit.Test; @@ -45,8 +45,7 @@ import java.io.File;  /**   * Test class for {@link TaskSnapshotPersister} and {@link TaskSnapshotLoader}   * - * Build/Install/Run: - *  atest WmTests:TaskSnapshotPersisterLoaderTest + * atest FrameworksServicesTests:TaskSnapshotPersisterLoaderTest   */  @MediumTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java index 8b8604365fa1..8b8604365fa1 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java +++ b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotSurfaceTest.java b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotSurfaceTest.java index 287fff554a61..b19373efd1b0 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotSurfaceTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotSurfaceTest.java @@ -19,7 +19,6 @@ package com.android.server.wm;  import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;  import static android.content.res.Configuration.ORIENTATION_PORTRAIT;  import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; -  import static org.junit.Assert.assertEquals;  import static org.mockito.Matchers.any;  import static org.mockito.Matchers.anyInt; @@ -48,8 +47,7 @@ import org.junit.runner.RunWith;  /**   * Test class for {@link TaskSnapshotSurface}.   * - * Build/Install/Run: - *  atest WmTests:TaskSnapshotSurfaceTest + * runtest frameworks-services -c com.android.server.wm.TaskSnapshotSurfaceTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskStackContainersTests.java b/services/tests/servicestests/src/com/android/server/wm/TaskStackContainersTests.java index e66b0d9c841d..ca1994f85ccf 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskStackContainersTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/TaskStackContainersTests.java @@ -18,25 +18,26 @@ package com.android.server.wm;  import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;  import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; -  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull;  import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.Before; +import org.junit.After; +  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -  /**   * Tests for the {@link DisplayContent.TaskStackContainers} container in {@link DisplayContent}.   *   * Build/Install/Run: - *  atest WmTests:TaskStackContainersTests + *  bit FrameworksServicesTests:com.android.server.wm.TaskStackContainersTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskStackTests.java b/services/tests/servicestests/src/com/android/server/wm/TaskStackTests.java index 0deb4af542c4..eaf71f0dc5b3 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskStackTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/TaskStackTests.java @@ -16,24 +16,27 @@  package com.android.server.wm; -import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; -import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import org.junit.Test; +import org.junit.runner.RunWith;  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; -import org.junit.Test; -import org.junit.runner.RunWith; +import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; +import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue;  /**   * Tests for the {@link TaskStack} class.   *   * Build/Install/Run: - *  atest WmTests:TaskStackTests + *  bit FrameworksServicesTests:com.android.server.wm.TaskStackTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskWindowContainerControllerTests.java b/services/tests/servicestests/src/com/android/server/wm/TaskWindowContainerControllerTests.java index e734bc0615c6..1dd9365825cf 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskWindowContainerControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/TaskWindowContainerControllerTests.java @@ -16,23 +16,22 @@  package com.android.server.wm; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; -  import org.junit.Test;  import org.junit.runner.RunWith; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +  /**   * Test class for {@link TaskWindowContainerController}.   *   * Build/Install/Run: - *  atest WmTests:TaskWindowContainerControllerTests + *  bit FrameworksServicesTests:com.android.server.wm.TaskWindowContainerControllerTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java b/services/tests/servicestests/src/com/android/server/wm/TestIWindow.java index 032f4162b48e..353aa7deb534 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java +++ b/services/tests/servicestests/src/com/android/server/wm/TestIWindow.java @@ -16,6 +16,8 @@  package com.android.server.wm; +import com.android.internal.os.IResultReceiver; +  import android.graphics.Rect;  import android.os.Bundle;  import android.os.ParcelFileDescriptor; @@ -25,8 +27,6 @@ import android.view.DisplayCutout;  import android.view.DragEvent;  import android.view.IWindow; -import com.android.internal.os.IResultReceiver; -  public class TestIWindow extends IWindow.Stub {      @Override      public void executeCommand(String command, String parameters, diff --git a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java b/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java index ee028ba4262b..ee028ba4262b 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java +++ b/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java diff --git a/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java b/services/tests/servicestests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java index 903352b7bec5..a5c47deb2c06 100644 --- a/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java @@ -29,8 +29,7 @@ import org.junit.runner.RunWith;  /**   * Test class for {@link AppTransition}.   * - * Build/Install/Run: - *  atest WmTests:UnknownAppVisibilityControllerTest + * runtest frameworks-services -c com.android.server.wm.UnknownAppVisibilityControllerTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java b/services/tests/servicestests/src/com/android/server/wm/WallpaperControllerTests.java index 71ead204c9df..71ead204c9df 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/WallpaperControllerTests.java diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowAnimationSpecTest.java b/services/tests/servicestests/src/com/android/server/wm/WindowAnimationSpecTest.java index aac905e8ffd4..ca520ed76be6 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowAnimationSpecTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowAnimationSpecTest.java @@ -40,8 +40,7 @@ import org.junit.runner.RunWith;  /**   * Tests for the {@link WindowAnimationSpec} class.   * - * Build/Install/Run: - *  atest WmTests:WindowAnimationSpecTest + *  atest FrameworksServicesTests:com.android.server.wm.WindowAnimationSpecTest   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowConfigurationTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java index 9c59a1748dbf..513c1ecda990 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowConfigurationTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java @@ -16,16 +16,7 @@  package com.android.server.wm; -import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; -import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; -import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; -import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; -import static android.app.WindowConfiguration.WINDOW_CONFIG_APP_BOUNDS; -import static android.app.WindowConfiguration.WINDOW_CONFIG_WINDOWING_MODE; -import static android.content.pm.ActivityInfo.CONFIG_WINDOW_CONFIGURATION; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import org.junit.Test;  import android.app.WindowConfiguration;  import android.content.res.Configuration; @@ -36,13 +27,22 @@ import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4;  import android.view.DisplayInfo; -import org.junit.Test; +import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; +import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; +import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; +import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; +import static android.app.WindowConfiguration.WINDOW_CONFIG_APP_BOUNDS; +import static android.app.WindowConfiguration.WINDOW_CONFIG_WINDOWING_MODE; +import static android.content.pm.ActivityInfo.CONFIG_WINDOW_CONFIGURATION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue;  /**   * Test class to for {@link android.app.WindowConfiguration}.   *   * Build/Install/Run: - *  atest WmTests:WindowConfigurationTests + *  bit FrameworksServicesTests:com.android.server.wm.WindowConfigurationTests   */  @SmallTest  @FlakyTest(bugId = 74078662) diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowContainerControllerTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowContainerControllerTests.java index 05f7c347f0b8..502cb6e27c68 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowContainerControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowContainerControllerTests.java @@ -16,26 +16,26 @@  package com.android.server.wm; -import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; -import static android.content.res.Configuration.EMPTY; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - +import android.app.WindowConfiguration;  import android.content.res.Configuration; -import android.platform.test.annotations.Presubmit;  import android.support.test.filters.FlakyTest; +import org.junit.Test; + +import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; -import org.junit.Test; +import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; +import static android.content.res.Configuration.EMPTY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue;  /**   * Test class for {@link WindowContainerController}.   *   * Build/Install/Run: - *  atest WmTests:WindowContainerControllerTests + *  bit FrameworksServicesTests:com.android.server.wm.WindowContainerControllerTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowContainerTests.java index 5beeee151497..6c7830e5cf79 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowContainerTests.java @@ -16,6 +16,20 @@  package com.android.server.wm; +import android.support.test.filters.FlakyTest; +import android.view.SurfaceControl; +import android.view.SurfaceSession; +import org.junit.Test; +import org.junit.runner.RunWith; + +import android.content.res.Configuration; +import android.graphics.Rect; +import android.platform.test.annotations.Presubmit; +import android.support.test.filters.SmallTest; +import android.support.test.runner.AndroidJUnit4; + +import java.util.Comparator; +  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; @@ -30,6 +44,7 @@ import static org.junit.Assert.assertFalse;  import static org.junit.Assert.assertNotNull;  import static org.junit.Assert.assertNull;  import static org.junit.Assert.assertTrue; +  import static org.mockito.Mockito.any;  import static org.mockito.Mockito.anyFloat;  import static org.mockito.Mockito.eq; @@ -38,25 +53,11 @@ import static org.mockito.Mockito.never;  import static org.mockito.Mockito.times;  import static org.mockito.Mockito.verify; -import android.content.res.Configuration; -import android.graphics.Rect; -import android.platform.test.annotations.Presubmit; -import android.support.test.filters.FlakyTest; -import android.support.test.filters.SmallTest; -import android.support.test.runner.AndroidJUnit4; -import android.view.SurfaceControl; -import android.view.SurfaceSession; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.util.Comparator; -  /**   * Test class for {@link WindowContainer}.   *   * Build/Install/Run: - *  atest WmTests:WindowContainerTests + *  atest FrameworksServicesTests:com.android.server.wm.WindowContainerTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTraversalTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowContainerTraversalTests.java index e1acd78c5bc6..e07639933b7a 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTraversalTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowContainerTraversalTests.java @@ -20,10 +20,9 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;  import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;  import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;  import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; - -import static org.mockito.Matchers.eq;  import static org.mockito.Mockito.mock;  import static org.mockito.Mockito.verify; +import static org.mockito.Matchers.eq;  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest; @@ -32,13 +31,12 @@ import android.support.test.runner.AndroidJUnit4;  import org.junit.Test;  import org.junit.runner.RunWith; +import org.mockito.Mock; +  import java.util.function.Consumer;  /**   * Tests for {@link WindowContainer#forAllWindows} and various implementations. - * - * Build/Install/Run: - *  atest WmTests:WindowContainerTraversalTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java index 6a00de473a85..5a563320f9cb 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java @@ -16,12 +16,9 @@  package com.android.server.wm; -import static android.view.DisplayCutout.fromBoundingRect; -import static android.view.WindowManager.LayoutParams.FILL_PARENT; -import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith;  import android.app.ActivityManager.TaskDescription;  import android.content.res.Configuration; @@ -34,17 +31,18 @@ import android.view.Gravity;  import android.view.IWindow;  import android.view.WindowManager; -import com.android.server.wm.utils.WmDisplayCutout; +import static android.view.DisplayCutout.fromBoundingRect; +import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; +import static android.view.WindowManager.LayoutParams.FILL_PARENT; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import com.android.server.wm.utils.WmDisplayCutout;  /**   * Tests for the {@link WindowState#computeFrameLw} method and other window frame machinery.   * - * Build/Install/Run: - *  atest WmTests:WindowFrameTests + * Build/Install/Run: bit FrameworksServicesTests:com.android.server.wm.WindowFrameTests   */  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java b/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRule.java index d91079e3bb1b..d91079e3bb1b 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRule.java diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRuleTest.java b/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRuleTest.java index 6cf6d7bc96ec..6cf6d7bc96ec 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRuleTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRuleTest.java diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java index 0f07e7eb3090..85e846db60b7 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java @@ -16,6 +16,17 @@  package com.android.server.wm; +import android.view.WindowManager; +import org.junit.Test; +import org.junit.runner.RunWith; + +import android.platform.test.annotations.Presubmit; +import android.support.test.filters.FlakyTest; +import android.support.test.filters.SmallTest; +import android.support.test.runner.AndroidJUnit4; + +import java.util.LinkedList; +  import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;  import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;  import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW; @@ -44,22 +55,10 @@ import static org.mockito.Mockito.reset;  import static org.mockito.Mockito.spy;  import static org.mockito.Mockito.verify; -import android.platform.test.annotations.Presubmit; -import android.support.test.filters.FlakyTest; -import android.support.test.filters.SmallTest; -import android.support.test.runner.AndroidJUnit4; -import android.view.WindowManager; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.util.LinkedList; -  /**   * Tests for the {@link WindowState} class.   * - * Build/Install/Run: - *  atest WmTests:WindowStateTests + * atest FrameworksServicesTests:com.android.server.wm.WindowStateTests   */  @SmallTest  @FlakyTest(bugId = 74078662) diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowSurfacePlacerTest.java b/services/tests/servicestests/src/com/android/server/wm/WindowSurfacePlacerTest.java index 13f791634e4f..e173b7db2da7 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowSurfacePlacerTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowSurfacePlacerTest.java @@ -20,7 +20,6 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;  import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;  import static android.view.WindowManager.TRANSIT_TASK_CLOSE;  import static android.view.WindowManager.TRANSIT_TASK_OPEN; -  import static junit.framework.Assert.assertEquals;  import android.platform.test.annotations.Presubmit; @@ -32,12 +31,6 @@ import org.junit.Before;  import org.junit.Test;  import org.junit.runner.RunWith; -/** - * Tests for {@link WindowSurfacePlacer}. - * - * Build/Install/Run: - *  atest WmTests:WindowSurfacePlacerTest - */  @SmallTest  @Presubmit  @RunWith(AndroidJUnit4.class) diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java b/services/tests/servicestests/src/com/android/server/wm/WindowTestUtils.java index 6ab9c3010dd5..2e4740b57255 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowTestUtils.java @@ -16,12 +16,21 @@  package com.android.server.wm; +import android.app.ActivityManager; +import android.content.Context; +import android.content.res.Configuration; +import android.graphics.Rect; +import android.os.Binder; +import android.os.IBinder; +import android.view.IApplicationToken; +import android.view.IWindow; +import android.view.WindowManager; +  import static android.app.AppOpsManager.OP_NONE;  import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;  import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;  import static com.android.server.wm.WindowContainer.POSITION_TOP; -  import static org.mockito.Mockito.any;  import static org.mockito.Mockito.anyBoolean;  import static org.mockito.Mockito.anyFloat; @@ -30,15 +39,6 @@ import static org.mockito.Mockito.doAnswer;  import static org.mockito.Mockito.mock;  import static org.mockito.Mockito.when; -import android.app.ActivityManager; -import android.content.res.Configuration; -import android.graphics.Rect; -import android.os.Binder; -import android.os.IBinder; -import android.view.IApplicationToken; -import android.view.IWindow; -import android.view.WindowManager; -  import org.mockito.invocation.InvocationOnMock;  /** diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/servicestests/src/com/android/server/wm/WindowTestsBase.java index 473a287e3d9c..473a287e3d9c 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowTestsBase.java diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTokenTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowTokenTests.java index 5ea87b14f746..e3b717435052 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowTokenTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowTokenTests.java @@ -16,29 +16,29 @@  package com.android.server.wm; +import org.junit.Test; +import org.junit.runner.RunWith; + +import android.platform.test.annotations.Presubmit; +import android.support.test.filters.FlakyTest; +import android.support.test.filters.SmallTest; +import android.support.test.runner.AndroidJUnit4; +  import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;  import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;  import static android.view.WindowManager.LayoutParams.TYPE_TOAST; -  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse;  import static org.junit.Assert.assertNotNull;  import static org.junit.Assert.assertNull;  import static org.junit.Assert.assertTrue; - -import android.platform.test.annotations.Presubmit; -import android.support.test.filters.FlakyTest; -import android.support.test.filters.SmallTest; -import android.support.test.runner.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; +import static org.mockito.Mockito.mock;  /**   * Tests for the {@link WindowToken} class.   *   * Build/Install/Run: - *  atest WmTests:WindowTokenTests + *  bit FrameworksServicesTests:com.android.server.wm.WindowTokenTests   */  @SmallTest  @FlakyTest(bugId = 74078662) diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTracingTest.java b/services/tests/servicestests/src/com/android/server/wm/WindowTracingTest.java index f60ae75b85f2..50852548f525 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowTracingTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowTracingTest.java @@ -30,12 +30,13 @@ import static org.mockito.Mockito.verifyZeroInteractions;  import android.content.Context;  import android.platform.test.annotations.Presubmit;  import android.support.test.InstrumentationRegistry; -import android.support.test.filters.FlakyTest;  import android.support.test.filters.SmallTest; +import android.support.test.filters.FlakyTest;  import android.support.test.runner.AndroidJUnit4;  import android.util.proto.ProtoOutputStream;  import com.android.internal.util.Preconditions; +import com.android.server.wm.WindowManagerTraceProto;  import org.junit.After;  import org.junit.Before; @@ -53,7 +54,7 @@ import java.nio.charset.StandardCharsets;   * Test class for {@link WindowTracing}.   *   * Build/Install/Run: - *  atest WmTests:WindowTracingTest + *  bit FrameworksServicesTests:com.android.server.wm.WindowTracingTest   */  @SmallTest  @FlakyTest(bugId = 74078662) diff --git a/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java b/services/tests/servicestests/src/com/android/server/wm/ZOrderingTests.java index a730b5cf84e6..547be551c842 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/ZOrderingTests.java @@ -27,14 +27,15 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_  import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;  import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY;  import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; +import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;  import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;  import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL;  import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;  import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;  import android.platform.test.annotations.Presubmit; -import android.support.test.filters.FlakyTest;  import android.support.test.filters.SmallTest; +import android.support.test.filters.FlakyTest;  import android.support.test.runner.AndroidJUnit4;  import android.view.SurfaceControl;  import android.view.SurfaceSession; @@ -50,7 +51,7 @@ import java.util.LinkedList;   * Tests for the {@link WindowLayersController} class.   *   * Build/Install/Run: - *  atest WmTests:ZOrderingTests + *  bit FrameworksServicesTests:com.android.server.wm.ZOrderingTests   */  @SmallTest  @FlakyTest(bugId = 74078662) diff --git a/services/tests/wmtests/src/com/android/server/wm/utils/CoordinateTransformsTest.java b/services/tests/servicestests/src/com/android/server/wm/utils/CoordinateTransformsTest.java index f0f3023f1f17..40a10e04c893 100644 --- a/services/tests/wmtests/src/com/android/server/wm/utils/CoordinateTransformsTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/utils/CoordinateTransformsTest.java @@ -21,11 +21,10 @@ import static android.view.Surface.ROTATION_180;  import static android.view.Surface.ROTATION_270;  import static android.view.Surface.ROTATION_90; -import static com.android.server.wm.utils.CoordinateTransforms -        .transformPhysicalToLogicalCoordinates; +import static com.android.server.wm.utils.CoordinateTransforms.transformPhysicalToLogicalCoordinates;  import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.*;  import android.graphics.Matrix;  import android.graphics.Point; @@ -36,12 +35,6 @@ import org.junit.Rule;  import org.junit.Test;  import org.junit.rules.ErrorCollector; -/** - * Tests for {@link CoordinateTransforms}. - * - * Build/Install/Run: - *  atest WmTests:CoordinateTransformsTest - */  public class CoordinateTransformsTest {      private static final int W = 200; @@ -102,4 +95,4 @@ public class CoordinateTransformsTest {      public interface DevicePointAssertable {          void mapsToLogicalPoint(int x, int y);      } -} +}
\ No newline at end of file diff --git a/services/tests/wmtests/src/com/android/server/wm/utils/InsetUtilsTest.java b/services/tests/servicestests/src/com/android/server/wm/utils/InsetUtilsTest.java index ff3d883056e4..d0f0fe315bcf 100644 --- a/services/tests/wmtests/src/com/android/server/wm/utils/InsetUtilsTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/utils/InsetUtilsTest.java @@ -22,16 +22,11 @@ import android.graphics.Rect;  import android.platform.test.annotations.Presubmit;  import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4; +import android.util.Pair;  import org.junit.Test;  import org.junit.runner.RunWith; -/** - * Tests for {@link InsetUtils}. - * - * Build/Install/Run: - *  atest WmTests:InsetUtilsTest - */  @RunWith(AndroidJUnit4.class)  @SmallTest  @Presubmit diff --git a/services/tests/wmtests/src/com/android/server/wm/utils/RotationCacheTest.java b/services/tests/servicestests/src/com/android/server/wm/utils/RotationCacheTest.java index c800fa2fe6b1..6bbc7eb56688 100644 --- a/services/tests/wmtests/src/com/android/server/wm/utils/RotationCacheTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/utils/RotationCacheTest.java @@ -29,16 +29,13 @@ import android.support.test.filters.SmallTest;  import android.support.test.runner.AndroidJUnit4;  import android.util.Pair; +import com.android.server.wm.utils.RotationCache.RotationDependentComputation; + +import org.hamcrest.Matchers;  import org.junit.Before;  import org.junit.Test;  import org.junit.runner.RunWith; -/** - * Tests for {@link RotationCache}. - * - * Build/Install/Run: - *  atest WmTests:RotationCacheTest - */  @RunWith(AndroidJUnit4.class)  @SmallTest  @FlakyTest(bugId = 74078662) diff --git a/services/tests/wmtests/src/com/android/server/wm/utils/WmDisplayCutoutTest.java b/services/tests/servicestests/src/com/android/server/wm/utils/WmDisplayCutoutTest.java index f4c208b4ce0e..f7addf6c77f9 100644 --- a/services/tests/wmtests/src/com/android/server/wm/utils/WmDisplayCutoutTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/utils/WmDisplayCutoutTest.java @@ -16,6 +16,7 @@  package com.android.server.wm.utils; +  import static android.view.DisplayCutout.NO_CUTOUT;  import static android.view.DisplayCutout.fromBoundingRect; @@ -37,8 +38,7 @@ import java.util.Arrays;  /**   * Tests for {@link WmDisplayCutout}   * - * Build/Install/Run: - *  atest WmTests:WmDisplayCutoutTest + * Run with: atest WmDisplayCutoutTest   */  @RunWith(AndroidJUnit4.class)  @SmallTest diff --git a/services/tests/wmtests/Android.mk b/services/tests/wmtests/Android.mk index cd289740ea1e..0f8b18ab92cf 100644 --- a/services/tests/wmtests/Android.mk +++ b/services/tests/wmtests/Android.mk @@ -14,14 +14,9 @@ LOCAL_SRC_FILES := \      $(call all-java-files-under, ../servicestests/utils)  LOCAL_STATIC_JAVA_LIBRARIES := \ -    frameworks-base-testutils \ -    services.core \ -    android-support-test \ +    androidx-test \      mockito-target-minus-junit4 \      platform-test-annotations \ -    truth-prebuilt \ -    testables \ -    ub-uiautomator \  LOCAL_JAVA_LIBRARIES := \      android.test.mock \ diff --git a/services/tests/wmtests/AndroidManifest.xml b/services/tests/wmtests/AndroidManifest.xml index 7e4bd42c8c55..1fb947309028 100644 --- a/services/tests/wmtests/AndroidManifest.xml +++ b/services/tests/wmtests/AndroidManifest.xml @@ -22,30 +22,10 @@          android:minSdkVersion="1"          android:targetSdkVersion="28" /> -    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> -    <uses-permission android:name="android.permission.WAKE_LOCK" /> -    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" /> -    <uses-permission android:name="android.permission.MANAGE_ACTIVITY_STACKS" /> -    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" /> -    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> -    <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" /> -    <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> -    <uses-permission android:name="android.permission.READ_FRAME_BUFFER" /> -    <uses-permission android:name="android.permission.GET_TOP_ACTIVITY_INFO" /> -    <uses-permission android:name="android.permission.REORDER_TASKS" /> -    <uses-permission android:name="android.permission.MANAGE_USERS" /> - -    <application android:testOnly="true"> -        <activity android:name="com.android.server.am.TaskStackChangedListenerTest$ActivityA" /> -        <activity android:name="com.android.server.am.TaskStackChangedListenerTest$ActivityB" /> -        <activity android:name="com.android.server.am.TaskStackChangedListenerTest$ActivityRequestedOrientationChange" /> -        <activity android:name="com.android.server.am.TaskStackChangedListenerTest$ActivityTaskChangeCallbacks" /> -        <activity android:name="com.android.server.am.TaskStackChangedListenerTest$ActivityTaskDescriptionChange" /> -        <activity android:name="com.android.server.wm.ScreenDecorWindowTests$TestActivity" /> -    </application> +    <application android:testOnly="true" />      <instrumentation -        android:name="android.support.test.runner.AndroidJUnitRunner" +        android:name="androidx.test.runner.AndroidJUnitRunner"          android:label="Window Manager Tests"          android:targetPackage="com.android.frameworks.wmtests" />  </manifest> diff --git a/services/tests/wmtests/AndroidTest.xml b/services/tests/wmtests/AndroidTest.xml index 38a62ae9bbe3..2717ef901216 100644 --- a/services/tests/wmtests/AndroidTest.xml +++ b/services/tests/wmtests/AndroidTest.xml @@ -24,9 +24,9 @@      </target_preparer>      <option name="test-tag" value="WmTests" /> -    <test class="com.android.tradefed.testtype.AndroidJUnitTest" > +    <test class="com.android.tradefed.testtype.AndroidJUnitTest">          <option name="package" value="com.android.frameworks.wmtests" /> -        <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" /> -        <option name="hidden-api-checks" value="false"/> +        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" /> +        <option name="hidden-api-checks" value="false" />      </test>  </configuration> diff --git a/services/tests/wmtests/src/com/android/server/am/DummyAmTests.java b/services/tests/wmtests/src/com/android/server/am/DummyAmTests.java new file mode 100644 index 000000000000..023e4ab6636f --- /dev/null +++ b/services/tests/wmtests/src/com/android/server/am/DummyAmTests.java @@ -0,0 +1,46 @@ +/* + * 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.am; + +import android.platform.test.annotations.Presubmit; + +import org.junit.Test; + +import androidx.test.filters.FlakyTest; + +/** + * Dummy test for com.android.server.am. + * TODO(b/113800711): Remove this class once the actual tests are moved from servicestests. + */ +public class DummyAmTests { + +    @Presubmit +    @Test +    public void preSubmitTest() {} + +    @FlakyTest +    @Presubmit +    @Test +    public void flakyPreSubmitTest() {} + +    @Test +    public void postSubmitTest() {} + +    @FlakyTest +    @Test +    public void flakyPostSubmitTest() {} +} diff --git a/services/tests/wmtests/src/com/android/server/wm/DummyWmTests.java b/services/tests/wmtests/src/com/android/server/wm/DummyWmTests.java new file mode 100644 index 000000000000..aecb2783badd --- /dev/null +++ b/services/tests/wmtests/src/com/android/server/wm/DummyWmTests.java @@ -0,0 +1,46 @@ +/* + * 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; + +import android.platform.test.annotations.Presubmit; + +import org.junit.Test; + +import androidx.test.filters.FlakyTest; + +/** + * Dummy test for com.android.server.wm + * TODO(b/113800711): Remove this class once the actual tests are moved from servicestests. + */ +public class DummyWmTests { + +    @Presubmit +    @Test +    public void preSubmitTest() {} + +    @FlakyTest +    @Presubmit +    @Test +    public void flakyPreSubmitTest() {} + +    @Test +    public void postSubmitTest() {} + +    @FlakyTest +    @Test +    public void flakyPostSubmitTest() {} +} diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index 08bc9bcc4003..daa09f574651 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -397,7 +397,19 @@ public final class Call {          public static final int PROPERTY_WIFI = 0x00000008;          /** -         * Call is using high definition audio. +         * When set, the UI should indicate to the user that a call is using high definition +         * audio. +         * <p> +         * The underlying {@link ConnectionService} is responsible for reporting this +         * property.  It is important to note that this property is not intended to report the +         * actual audio codec being used for a Call, but whether the call should be indicated +         * to the user as high definition. +         * <p> +         * The Android Telephony stack reports this property for calls based on a number +         * of factors, including which audio codec is used and whether a call is using an HD +         * codec end-to-end.  Some mobile operators choose to suppress display of an HD indication, +         * and in these cases this property will not be set for a call even if the underlying audio +         * codec is in fact "high definition".           */          public static final int PROPERTY_HIGH_DEF_AUDIO = 0x00000010; diff --git a/telephony/java/android/provider/Telephony.java b/telephony/java/android/provider/Telephony.java index 7e63230b9abc..d48f21b6dfcd 100644 --- a/telephony/java/android/provider/Telephony.java +++ b/telephony/java/android/provider/Telephony.java @@ -3213,7 +3213,6 @@ public final class Telephony {              values.put(CDMA_ERI_ICON_INDEX, state.getCdmaEriIconIndex());              values.put(CDMA_ERI_ICON_MODE, state.getCdmaEriIconMode());              values.put(IS_EMERGENCY_ONLY, state.isEmergencyOnly()); -            values.put(IS_DATA_ROAMING_FROM_REGISTRATION, state.getDataRoamingFromRegistration());              values.put(IS_USING_CARRIER_AGGREGATION, state.isUsingCarrierAggregation());              return values;          } diff --git a/telephony/java/android/telephony/NeighboringCellInfo.java b/telephony/java/android/telephony/NeighboringCellInfo.java index 79298fd54c50..ac38efb4d029 100644 --- a/telephony/java/android/telephony/NeighboringCellInfo.java +++ b/telephony/java/android/telephony/NeighboringCellInfo.java @@ -34,8 +34,8 @@ import android.os.Parcelable;   * Received Signal Strength and Cell ID location.   *   * @deprecated This class should not be used by any app targeting - *     {@link Build.VERSION_CODES.Q Android Q} or higher. Instead callers should use - *     {@Link android.telephony.CellInfo CellInfo}. + *     {@link android.os.Build.VERSION_CODES#Q Android Q} or higher. Instead callers should use + *     {@link android.telephony.CellInfo CellInfo}.   */  @Deprecated  public class NeighboringCellInfo implements Parcelable diff --git a/telephony/java/android/telephony/NetworkRegistrationState.java b/telephony/java/android/telephony/NetworkRegistrationState.java index c3931557feb3..b312f8478413 100644 --- a/telephony/java/android/telephony/NetworkRegistrationState.java +++ b/telephony/java/android/telephony/NetworkRegistrationState.java @@ -95,6 +95,13 @@ public class NetworkRegistrationState implements Parcelable {      @RegState      private final int mRegState; +    /** +     * Save the {@link ServiceState.RoamingType roaming type}. it can be overridden roaming type +     * from resource overlay or carrier config. +     */ +    @ServiceState.RoamingType +    private int mRoamingType; +      private final int mAccessNetworkTechnology;      private final int mRejectCause; @@ -140,6 +147,8 @@ public class NetworkRegistrationState implements Parcelable {          mDomain = domain;          mTransportType = transportType;          mRegState = regState; +        mRoamingType = (regState == REG_STATE_ROAMING) +                ? ServiceState.ROAMING_TYPE_UNKNOWN : ServiceState.ROAMING_TYPE_NOT_ROAMING;          mAccessNetworkTechnology = accessNetworkTechnology;          mRejectCause = rejectCause;          mAvailableServices = availableServices; @@ -182,6 +191,7 @@ public class NetworkRegistrationState implements Parcelable {          mDomain = source.readInt();          mTransportType = source.readInt();          mRegState = source.readInt(); +        mRoamingType = source.readInt();          mAccessNetworkTechnology = source.readInt();          mRejectCause = source.readInt();          mEmergencyOnly = source.readBoolean(); @@ -211,6 +221,31 @@ public class NetworkRegistrationState implements Parcelable {      }      /** +     * @return {@code true} if registered on roaming network, {@code false} otherwise. +     */ +    public boolean isRoaming() { +        return mRoamingType != ServiceState.ROAMING_TYPE_NOT_ROAMING; +    } + +    /** +     * Set {@link ServiceState.RoamingType roaming type}. This could override +     * roaming type based on resource overlay or carrier config. +     * @hide +     */ +    public void setRoamingType(@ServiceState.RoamingType int roamingType) { +        mRoamingType = roamingType; +    } + +    /** +     * @return {@link ServiceState.RoamingType roaming type}. This could return +     * overridden roaming type based on resource overlay or carrier config. +     * @hide +     */ +    public @ServiceState.RoamingType int getRoamingType() { +        return mRoamingType; +    } + +    /**       * @return Whether emergency is enabled.       */      public boolean isEmergencyEnabled() { return mEmergencyOnly; } @@ -280,6 +315,7 @@ public class NetworkRegistrationState implements Parcelable {                  .append(" domain=").append((mDomain == DOMAIN_CS) ? "CS" : "PS")                  .append("transportType=").append(mTransportType)                  .append(" regState=").append(regStateToString(mRegState)) +                .append(" roamingType=").append(mRoamingType)                  .append(" accessNetworkTechnology=")                  .append(TelephonyManager.getNetworkTypeName(mAccessNetworkTechnology))                  .append(" rejectCause=").append(mRejectCause) @@ -293,9 +329,9 @@ public class NetworkRegistrationState implements Parcelable {      @Override      public int hashCode() { -        return Objects.hash(mDomain, mTransportType, mRegState, mAccessNetworkTechnology, -                mRejectCause, mEmergencyOnly, mAvailableServices, mCellIdentity, -                mVoiceSpecificStates, mDataSpecificStates); +        return Objects.hash(mDomain, mTransportType, mRegState, mRoamingType, +                mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices, +                mCellIdentity, mVoiceSpecificStates, mDataSpecificStates);      }      @Override @@ -310,6 +346,7 @@ public class NetworkRegistrationState implements Parcelable {          return mDomain == other.mDomain                  && mTransportType == other.mTransportType                  && mRegState == other.mRegState +                && mRoamingType == other.mRoamingType                  && mAccessNetworkTechnology == other.mAccessNetworkTechnology                  && mRejectCause == other.mRejectCause                  && mEmergencyOnly == other.mEmergencyOnly @@ -325,6 +362,7 @@ public class NetworkRegistrationState implements Parcelable {          dest.writeInt(mDomain);          dest.writeInt(mTransportType);          dest.writeInt(mRegState); +        dest.writeInt(mRoamingType);          dest.writeInt(mAccessNetworkTechnology);          dest.writeInt(mRejectCause);          dest.writeBoolean(mEmergencyOnly); diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 7469186a5d51..e0ec2c50ab5b 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -20,6 +20,7 @@ import android.annotation.IntDef;  import android.annotation.SystemApi;  import android.annotation.TestApi;  import android.annotation.UnsupportedAppUsage; +import android.content.Intent;  import android.os.Bundle;  import android.os.Parcel;  import android.os.Parcelable; @@ -57,7 +58,7 @@ public class ServiceState implements Parcelable {       * Normal operation condition, the phone is registered       * with an operator either in home network or in roaming.       */ -    public static final int STATE_IN_SERVICE = 0; +    public static final int STATE_IN_SERVICE = TelephonyProtoEnums.SERVICE_STATE_IN_SERVICE; // 0      /**       * Phone is not registered with any operator, the phone @@ -65,17 +66,19 @@ public class ServiceState implements Parcelable {       * searching to registration at all, or registration is denied, or radio       * signal is not available.       */ -    public static final int STATE_OUT_OF_SERVICE = 1; +    public static final int STATE_OUT_OF_SERVICE = +            TelephonyProtoEnums.SERVICE_STATE_OUT_OF_SERVICE;  // 1      /**       * The phone is registered and locked.  Only emergency numbers are allowed. {@more}       */ -    public static final int STATE_EMERGENCY_ONLY = 2; +    public static final int STATE_EMERGENCY_ONLY = +            TelephonyProtoEnums.SERVICE_STATE_EMERGENCY_ONLY;  // 2      /**       * Radio of telephony is explicitly powered off.       */ -    public static final int STATE_POWER_OFF = 3; +    public static final int STATE_POWER_OFF = TelephonyProtoEnums.SERVICE_STATE_POWER_OFF;  // 3      /** @hide */      @Retention(RetentionPolicy.SOURCE) @@ -198,6 +201,15 @@ public class ServiceState implements Parcelable {      private int mVoiceRegState = STATE_OUT_OF_SERVICE;      private int mDataRegState = STATE_OUT_OF_SERVICE; +    /** @hide */ +    @Retention(RetentionPolicy.SOURCE) +    @IntDef(prefix = { "ROAMING_TYPE_" }, value = { +            ROAMING_TYPE_NOT_ROAMING, +            ROAMING_TYPE_UNKNOWN, +            ROAMING_TYPE_DOMESTIC, +            ROAMING_TYPE_INTERNATIONAL +    }) +    public @interface RoamingType {}      /**       * Roaming type       * HOME : in home network @@ -228,8 +240,6 @@ public class ServiceState implements Parcelable {       */      public static final int UNKNOWN_ID = -1; -    private int mVoiceRoamingType; -    private int mDataRoamingType;      private String mVoiceOperatorAlphaLong;      private String mVoiceOperatorAlphaShort;      private String mVoiceOperatorNumeric; @@ -259,8 +269,6 @@ public class ServiceState implements Parcelable {      @UnsupportedAppUsage      private int mCdmaEriIconMode; -    private boolean mIsDataRoamingFromRegistration; -      @UnsupportedAppUsage      private boolean mIsUsingCarrierAggregation; @@ -332,8 +340,6 @@ public class ServiceState implements Parcelable {      protected void copyFrom(ServiceState s) {          mVoiceRegState = s.mVoiceRegState;          mDataRegState = s.mDataRegState; -        mVoiceRoamingType = s.mVoiceRoamingType; -        mDataRoamingType = s.mDataRoamingType;          mVoiceOperatorAlphaLong = s.mVoiceOperatorAlphaLong;          mVoiceOperatorAlphaShort = s.mVoiceOperatorAlphaShort;          mVoiceOperatorNumeric = s.mVoiceOperatorNumeric; @@ -351,7 +357,6 @@ public class ServiceState implements Parcelable {          mCdmaEriIconIndex = s.mCdmaEriIconIndex;          mCdmaEriIconMode = s.mCdmaEriIconMode;          mIsEmergencyOnly = s.mIsEmergencyOnly; -        mIsDataRoamingFromRegistration = s.mIsDataRoamingFromRegistration;          mIsUsingCarrierAggregation = s.mIsUsingCarrierAggregation;          mChannelNumber = s.mChannelNumber;          mCellBandwidths = s.mCellBandwidths == null ? null : @@ -367,8 +372,6 @@ public class ServiceState implements Parcelable {      public ServiceState(Parcel in) {          mVoiceRegState = in.readInt();          mDataRegState = in.readInt(); -        mVoiceRoamingType = in.readInt(); -        mDataRoamingType = in.readInt();          mVoiceOperatorAlphaLong = in.readString();          mVoiceOperatorAlphaShort = in.readString();          mVoiceOperatorNumeric = in.readString(); @@ -386,7 +389,6 @@ public class ServiceState implements Parcelable {          mCdmaEriIconIndex = in.readInt();          mCdmaEriIconMode = in.readInt();          mIsEmergencyOnly = in.readInt() != 0; -        mIsDataRoamingFromRegistration = in.readInt() != 0;          mIsUsingCarrierAggregation = in.readInt() != 0;          mLteEarfcnRsrpBoost = in.readInt();          mNetworkRegistrationStates = new ArrayList<>(); @@ -398,8 +400,6 @@ public class ServiceState implements Parcelable {      public void writeToParcel(Parcel out, int flags) {          out.writeInt(mVoiceRegState);          out.writeInt(mDataRegState); -        out.writeInt(mVoiceRoamingType); -        out.writeInt(mDataRoamingType);          out.writeString(mVoiceOperatorAlphaLong);          out.writeString(mVoiceOperatorAlphaShort);          out.writeString(mVoiceOperatorNumeric); @@ -417,7 +417,6 @@ public class ServiceState implements Parcelable {          out.writeInt(mCdmaEriIconIndex);          out.writeInt(mCdmaEriIconMode);          out.writeInt(mIsEmergencyOnly ? 1 : 0); -        out.writeInt(mIsDataRoamingFromRegistration ? 1 : 0);          out.writeInt(mIsUsingCarrierAggregation ? 1 : 0);          out.writeInt(mLteEarfcnRsrpBoost);          out.writeList(mNetworkRegistrationStates); @@ -535,17 +534,21 @@ public class ServiceState implements Parcelable {       */      @UnsupportedAppUsage      public boolean getVoiceRoaming() { -        return mVoiceRoamingType != ROAMING_TYPE_NOT_ROAMING; +        return getVoiceRoamingType() != ROAMING_TYPE_NOT_ROAMING;      } -      /**       * Get current voice network roaming type       * @return roaming type       * @hide       */      @UnsupportedAppUsage -    public int getVoiceRoamingType() { -        return mVoiceRoamingType; +    public @RoamingType int getVoiceRoamingType() { +        final NetworkRegistrationState regState = getNetworkRegistrationState( +                NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TransportType.WWAN); +        if (regState != null) { +            return regState.getRoamingType(); +        } +        return ROAMING_TYPE_NOT_ROAMING;      }      /** @@ -555,19 +558,7 @@ public class ServiceState implements Parcelable {       */      @UnsupportedAppUsage      public boolean getDataRoaming() { -        return mDataRoamingType != ROAMING_TYPE_NOT_ROAMING; -    } - -    /** -     * Set whether data network registration state is roaming -     * -     * This should only be set to the roaming value received -     * once the data registration phase has completed. -     * @hide -     */ -    @UnsupportedAppUsage -    public void setDataRoamingFromRegistration(boolean dataRoaming) { -        mIsDataRoamingFromRegistration = dataRoaming; +        return getDataRoamingType() != ROAMING_TYPE_NOT_ROAMING;      }      /** @@ -576,7 +567,12 @@ public class ServiceState implements Parcelable {       * @hide       */      public boolean getDataRoamingFromRegistration() { -        return mIsDataRoamingFromRegistration; +        final NetworkRegistrationState regState = getNetworkRegistrationState( +                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN); +        if (regState != null) { +            return (regState.getRegState() == NetworkRegistrationState.REG_STATE_ROAMING); +        } +        return false;      }      /** @@ -585,8 +581,13 @@ public class ServiceState implements Parcelable {       * @hide       */      @UnsupportedAppUsage -    public int getDataRoamingType() { -        return mDataRoamingType; +    public @RoamingType int getDataRoamingType() { +        final NetworkRegistrationState regState = getNetworkRegistrationState( +                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN); +        if (regState != null) { +            return regState.getRoamingType(); +        } +        return ROAMING_TYPE_NOT_ROAMING;      }      /** @@ -759,8 +760,6 @@ public class ServiceState implements Parcelable {          return Objects.hash(                  mVoiceRegState,                  mDataRegState, -                mVoiceRoamingType, -                mDataRoamingType,                  mChannelNumber,                  mCellBandwidths,                  mVoiceOperatorAlphaLong, @@ -780,7 +779,6 @@ public class ServiceState implements Parcelable {                  mCdmaEriIconIndex,                  mCdmaEriIconMode,                  mIsEmergencyOnly, -                mIsDataRoamingFromRegistration,                  mIsUsingCarrierAggregation,                  mLteEarfcnRsrpBoost,                  mNetworkRegistrationStates); @@ -794,8 +792,6 @@ public class ServiceState implements Parcelable {          return (mVoiceRegState == s.mVoiceRegState                  && mDataRegState == s.mDataRegState                  && mIsManualNetworkSelection == s.mIsManualNetworkSelection -                && mVoiceRoamingType == s.mVoiceRoamingType -                && mDataRoamingType == s.mDataRoamingType                  && mChannelNumber == s.mChannelNumber                  && Arrays.equals(mCellBandwidths, s.mCellBandwidths)                  && equalsHandlesNulls(mVoiceOperatorAlphaLong, s.mVoiceOperatorAlphaLong) @@ -813,7 +809,6 @@ public class ServiceState implements Parcelable {                  && equalsHandlesNulls(mCdmaDefaultRoamingIndicator,                          s.mCdmaDefaultRoamingIndicator)                  && mIsEmergencyOnly == s.mIsEmergencyOnly -                && mIsDataRoamingFromRegistration == s.mIsDataRoamingFromRegistration                  && mIsUsingCarrierAggregation == s.mIsUsingCarrierAggregation)                  && (mNetworkRegistrationStates == null ? s.mNetworkRegistrationStates == null :                          s.mNetworkRegistrationStates != null && @@ -933,8 +928,6 @@ public class ServiceState implements Parcelable {              .append(", mChannelNumber=").append(mChannelNumber)              .append(", duplexMode()=").append(getDuplexMode())              .append(", mCellBandwidths=").append(Arrays.toString(mCellBandwidths)) -            .append(", mVoiceRoamingType=").append(getRoamingLogString(mVoiceRoamingType)) -            .append(", mDataRoamingType=").append(getRoamingLogString(mDataRoamingType))              .append(", mVoiceOperatorAlphaLong=").append(mVoiceOperatorAlphaLong)              .append(", mVoiceOperatorAlphaShort=").append(mVoiceOperatorAlphaShort)              .append(", mDataOperatorAlphaLong=").append(mDataOperatorAlphaLong) @@ -951,7 +944,6 @@ public class ServiceState implements Parcelable {              .append(", mCdmaRoamingIndicator=").append(mCdmaRoamingIndicator)              .append(", mCdmaDefaultRoamingIndicator=").append(mCdmaDefaultRoamingIndicator)              .append(", mIsEmergencyOnly=").append(mIsEmergencyOnly) -            .append(", mIsDataRoamingFromRegistration=").append(mIsDataRoamingFromRegistration)              .append(", mIsUsingCarrierAggregation=").append(mIsUsingCarrierAggregation)              .append(", mLteEarfcnRsrpBoost=").append(mLteEarfcnRsrpBoost)              .append(", mNetworkRegistrationStates=").append(mNetworkRegistrationStates) @@ -962,8 +954,6 @@ public class ServiceState implements Parcelable {          if (DBG) Rlog.d(LOG_TAG, "[ServiceState] setNullState=" + state);          mVoiceRegState = state;          mDataRegState = state; -        mVoiceRoamingType = ROAMING_TYPE_NOT_ROAMING; -        mDataRoamingType = ROAMING_TYPE_NOT_ROAMING;          mChannelNumber = -1;          mCellBandwidths = new int[0];          mVoiceOperatorAlphaLong = null; @@ -983,7 +973,6 @@ public class ServiceState implements Parcelable {          mCdmaEriIconIndex = -1;          mCdmaEriIconMode = -1;          mIsEmergencyOnly = false; -        mIsDataRoamingFromRegistration = false;          mIsUsingCarrierAggregation = false;          mLteEarfcnRsrpBoost = 0;          mNetworkRegistrationStates = new ArrayList<>(); @@ -1029,32 +1018,50 @@ public class ServiceState implements Parcelable {      }      public void setRoaming(boolean roaming) { -        mVoiceRoamingType = (roaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING); -        mDataRoamingType = mVoiceRoamingType; +        setVoiceRoaming(roaming); +        setDataRoaming(roaming);      }      /** @hide */      @UnsupportedAppUsage      public void setVoiceRoaming(boolean roaming) { -        mVoiceRoamingType = (roaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING); +        setVoiceRoamingType(roaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING);      }      /** @hide */      @UnsupportedAppUsage -    public void setVoiceRoamingType(int type) { -        mVoiceRoamingType = type; +    public void setVoiceRoamingType(@RoamingType int type) { +        NetworkRegistrationState regState = getNetworkRegistrationState( +                NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TransportType.WWAN); +        if (regState == null) { +            regState = new NetworkRegistrationState( +                    NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TransportType.WWAN, +                    ServiceState.ROAMING_TYPE_NOT_ROAMING, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, +                    false, null, null); +            addNetworkRegistrationState(regState); +        } +        regState.setRoamingType(type);      }      /** @hide */      @UnsupportedAppUsage      public void setDataRoaming(boolean dataRoaming) { -        mDataRoamingType = (dataRoaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING); +        setDataRoamingType(dataRoaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING);      }      /** @hide */      @UnsupportedAppUsage -    public void setDataRoamingType(int type) { -        mDataRoamingType = type; +    public void setDataRoamingType(@RoamingType int type) { +        NetworkRegistrationState regState = getNetworkRegistrationState( +                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN); +        if (regState == null) { +            regState = new NetworkRegistrationState( +                    NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN, +                    ServiceState.ROAMING_TYPE_NOT_ROAMING, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, +                    false, null, null); +            addNetworkRegistrationState(regState); +        } +        regState.setRoamingType(type);      }      /** @@ -1166,30 +1173,10 @@ public class ServiceState implements Parcelable {       */      @UnsupportedAppUsage      private void setFromNotifierBundle(Bundle m) { -        mVoiceRegState = m.getInt("voiceRegState"); -        mDataRegState = m.getInt("dataRegState"); -        mVoiceRoamingType = m.getInt("voiceRoamingType"); -        mDataRoamingType = m.getInt("dataRoamingType"); -        mVoiceOperatorAlphaLong = m.getString("operator-alpha-long"); -        mVoiceOperatorAlphaShort = m.getString("operator-alpha-short"); -        mVoiceOperatorNumeric = m.getString("operator-numeric"); -        mDataOperatorAlphaLong = m.getString("data-operator-alpha-long"); -        mDataOperatorAlphaShort = m.getString("data-operator-alpha-short"); -        mDataOperatorNumeric = m.getString("data-operator-numeric"); -        mIsManualNetworkSelection = m.getBoolean("manual"); -        mRilVoiceRadioTechnology = m.getInt("radioTechnology"); -        mRilDataRadioTechnology = m.getInt("dataRadioTechnology"); -        mCssIndicator = m.getBoolean("cssIndicator"); -        mNetworkId = m.getInt("networkId"); -        mSystemId = m.getInt("systemId"); -        mCdmaRoamingIndicator = m.getInt("cdmaRoamingIndicator"); -        mCdmaDefaultRoamingIndicator = m.getInt("cdmaDefaultRoamingIndicator"); -        mIsEmergencyOnly = m.getBoolean("emergencyOnly"); -        mIsDataRoamingFromRegistration = m.getBoolean("isDataRoamingFromRegistration"); -        mIsUsingCarrierAggregation = m.getBoolean("isUsingCarrierAggregation"); -        mLteEarfcnRsrpBoost = m.getInt("LteEarfcnRsrpBoost"); -        mChannelNumber = m.getInt("ChannelNumber"); -        mCellBandwidths = m.getIntArray("CellBandwidths"); +        ServiceState ssFromBundle = m.getParcelable(Intent.EXTRA_SERVICE_STATE); +        if (ssFromBundle != null) { +            copyFrom(ssFromBundle); +        }      }      /** @@ -1200,10 +1187,13 @@ public class ServiceState implements Parcelable {       */      @UnsupportedAppUsage      public void fillInNotifierBundle(Bundle m) { +        m.putParcelable(Intent.EXTRA_SERVICE_STATE, this); +        // serviceState already consists of below entries. +        // for backward compatibility, we continue fill in below entries.          m.putInt("voiceRegState", mVoiceRegState);          m.putInt("dataRegState", mDataRegState); -        m.putInt("voiceRoamingType", mVoiceRoamingType); -        m.putInt("dataRoamingType", mDataRoamingType); +        m.putInt("dataRoamingType", getDataRoamingType()); +        m.putInt("voiceRoamingType", getVoiceRoamingType());          m.putString("operator-alpha-long", mVoiceOperatorAlphaLong);          m.putString("operator-alpha-short", mVoiceOperatorAlphaShort);          m.putString("operator-numeric", mVoiceOperatorNumeric); @@ -1219,7 +1209,7 @@ public class ServiceState implements Parcelable {          m.putInt("cdmaRoamingIndicator", mCdmaRoamingIndicator);          m.putInt("cdmaDefaultRoamingIndicator", mCdmaDefaultRoamingIndicator);          m.putBoolean("emergencyOnly", mIsEmergencyOnly); -        m.putBoolean("isDataRoamingFromRegistration", mIsDataRoamingFromRegistration); +        m.putBoolean("isDataRoamingFromRegistration", getDataRoamingFromRegistration());          m.putBoolean("isUsingCarrierAggregation", mIsUsingCarrierAggregation);          m.putInt("LteEarfcnRsrpBoost", mLteEarfcnRsrpBoost);          m.putInt("ChannelNumber", mChannelNumber); diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 7a99c715c93e..b0b7e7bdb748 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -32,12 +32,14 @@ import android.annotation.SystemService;  import android.annotation.UnsupportedAppUsage;  import android.app.BroadcastOptions;  import android.app.PendingIntent; +import android.app.job.JobService;  import android.content.Context;  import android.content.Intent;  import android.content.pm.PackageInfo;  import android.content.pm.PackageManager;  import android.content.res.Configuration;  import android.content.res.Resources; +import android.database.ContentObserver;  import android.net.INetworkPolicyManager;  import android.net.NetworkCapabilities;  import android.net.Uri; @@ -115,6 +117,52 @@ public class SubscriptionManager {      @UnsupportedAppUsage      public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo"); + +    /** +     * Generates a content {@link Uri} used to receive updates on simInfo change +     * on the given subscriptionId +     * @param subscriptionId the subscriptionId to receive updates on +     * @return the Uri used to observe carrier identity changes +     * @hide +     */ +    public static Uri getUriForSubscriptionId(int subscriptionId) { +        return Uri.withAppendedPath(CONTENT_URI, String.valueOf(subscriptionId)); +    } + +    /** +     * A content {@link Uri} used to receive updates on wfc enabled user setting. +     * <p> +     * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the +     * subscription wfc enabled {@link SubscriptionManager#WFC_IMS_ENABLED} +     * while your app is running. You can also use a {@link JobService} to ensure your app +     * is notified of changes to the {@link Uri} even when it is not running. +     * Note, however, that using a {@link JobService} does not guarantee timely delivery of +     * updates to the {@link Uri}. +     * To be notified of changes to a specific subId, append subId to the URI +     * {@link Uri#withAppendedPath(Uri, String)}. +     * @hide +     */ +    @SystemApi +    public static final Uri WFC_ENABLED_CONTENT_URI = Uri.withAppendedPath(CONTENT_URI, "wfc"); + +    /** +     * A content {@link Uri} used to receive updates on enhanced 4g user setting. +     * <p> +     * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the +     * subscription enhanced 4G enabled {@link SubscriptionManager#ENHANCED_4G_MODE_ENABLED} +     * while your app is running. You can also use a {@link JobService} to ensure your app +     * is notified of changes to the {@link Uri} even when it is not running. +     * Note, however, that using a {@link JobService} does not guarantee timely delivery of +     * updates to the {@link Uri}. +     * To be notified of changes to a specific subId, append subId to the URI +     * {@link Uri#withAppendedPath(Uri, String)}. +     * @hide +     */ +    @SystemApi +    public static final Uri ENHANCED_4G_ENABLED_CONTENT_URI = Uri.withAppendedPath( +            CONTENT_URI, "enhanced_4g"); + +      /**       * TelephonyProvider unique key column name is the subscription id.       * <P>Type: TEXT (String)</P> @@ -1602,7 +1650,7 @@ public class SubscriptionManager {       * Check if the subscription ID is usable.       *       * A usable subscription ID has a valid value except some special values such as -     * {@link DEFAULT_SUBSCRIPTION_ID}. It can be used for subscription functions. +     * {@link #DEFAULT_SUBSCRIPTION_ID}. It can be used for subscription functions.       *       * @param subscriptionId the subscription ID       * @return {@code true} if the subscription ID is usable; {@code false} otherwise. @@ -2178,20 +2226,21 @@ public class SubscriptionManager {      }      /** -     * Get User downloaded Profiles. +     * Get opportunistic data Profiles.       * -     *  Provide all available user downloaded profile on the phone. -     *  @param slotId on which phone the switch will operate on +     *  Provide all available user downloaded profiles on phone which are used only for +     *  opportunistic data. +     *  @param slotIndex slot on which the profiles are queried from.       */      @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) -    List<SubscriptionInfo> getOpportunisticSubscriptions(int slotId) { +    public List<SubscriptionInfo> getOpportunisticSubscriptions(int slotIndex) {          String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";          List<SubscriptionInfo> subInfoList = null;          try {              ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));              if (iSub != null) { -                subInfoList = iSub.getOpportunisticSubscriptions(slotId, pkgForDebug); +                subInfoList = iSub.getOpportunisticSubscriptions(slotIndex, pkgForDebug);              }          } catch (RemoteException ex) {              // ignore it diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 48f38fca9266..e4204482aa3d 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -60,12 +60,14 @@ import android.telephony.ims.aidl.IImsMmTelFeature;  import android.telephony.ims.aidl.IImsRcsFeature;  import android.telephony.ims.aidl.IImsRegistration;  import android.telephony.ims.stub.ImsRegistrationImplBase; +import android.text.TextUtils;  import android.util.Log;  import com.android.ims.internal.IImsServiceFeatureCallback;  import com.android.internal.annotations.VisibleForTesting;  import com.android.internal.telecom.ITelecomService;  import com.android.internal.telephony.CellNetworkScanResult; +import com.android.internal.telephony.IAns;  import com.android.internal.telephony.IPhoneSubInfo;  import com.android.internal.telephony.ITelephony;  import com.android.internal.telephony.ITelephonyRegistry; @@ -2418,39 +2420,46 @@ public class TelephonyManager {       *       * These are the ordinal value of IccCardConstants.State.       */ -    public static final int SIM_STATE_UNKNOWN = 0; + +    public static final int SIM_STATE_UNKNOWN = TelephonyProtoEnums.SIM_STATE_UNKNOWN;  // 0      /** SIM card state: no SIM card is available in the device */ -    public static final int SIM_STATE_ABSENT = 1; +    public static final int SIM_STATE_ABSENT = TelephonyProtoEnums.SIM_STATE_ABSENT;  // 1      /** SIM card state: Locked: requires the user's SIM PIN to unlock */ -    public static final int SIM_STATE_PIN_REQUIRED = 2; +    public static final int SIM_STATE_PIN_REQUIRED = +            TelephonyProtoEnums.SIM_STATE_PIN_REQUIRED;  // 2      /** SIM card state: Locked: requires the user's SIM PUK to unlock */ -    public static final int SIM_STATE_PUK_REQUIRED = 3; +    public static final int SIM_STATE_PUK_REQUIRED = +            TelephonyProtoEnums.SIM_STATE_PUK_REQUIRED;  // 3      /** SIM card state: Locked: requires a network PIN to unlock */ -    public static final int SIM_STATE_NETWORK_LOCKED = 4; +    public static final int SIM_STATE_NETWORK_LOCKED = +            TelephonyProtoEnums.SIM_STATE_NETWORK_LOCKED;  // 4      /** SIM card state: Ready */ -    public static final int SIM_STATE_READY = 5; +    public static final int SIM_STATE_READY = TelephonyProtoEnums.SIM_STATE_READY;  // 5      /** SIM card state: SIM Card is NOT READY */ -    public static final int SIM_STATE_NOT_READY = 6; +    public static final int SIM_STATE_NOT_READY = TelephonyProtoEnums.SIM_STATE_NOT_READY;  // 6      /** SIM card state: SIM Card Error, permanently disabled */ -    public static final int SIM_STATE_PERM_DISABLED = 7; +    public static final int SIM_STATE_PERM_DISABLED = +            TelephonyProtoEnums.SIM_STATE_PERM_DISABLED;  // 7      /** SIM card state: SIM Card Error, present but faulty */ -    public static final int SIM_STATE_CARD_IO_ERROR = 8; +    public static final int SIM_STATE_CARD_IO_ERROR = +            TelephonyProtoEnums.SIM_STATE_CARD_IO_ERROR;  // 8      /** SIM card state: SIM Card restricted, present but not usable due to       * carrier restrictions.       */ -    public static final int SIM_STATE_CARD_RESTRICTED = 9; +    public static final int SIM_STATE_CARD_RESTRICTED = +            TelephonyProtoEnums.SIM_STATE_CARD_RESTRICTED;  // 9      /**       * SIM card state: Loaded: SIM card applications have been loaded       * @hide       */      @SystemApi -    public static final int SIM_STATE_LOADED = 10; +    public static final int SIM_STATE_LOADED = TelephonyProtoEnums.SIM_STATE_LOADED;  // 10      /**       * SIM card state: SIM Card is present       * @hide       */      @SystemApi -    public static final int SIM_STATE_PRESENT = 11; +    public static final int SIM_STATE_PRESENT = TelephonyProtoEnums.SIM_STATE_PRESENT;  // 11      /**       * Extra included in {@link #ACTION_SIM_CARD_STATE_CHANGED} and @@ -4412,6 +4421,10 @@ public class TelephonyManager {          return ITelephonyRegistry.Stub.asInterface(ServiceManager.getService("telephony.registry"));      } +    private IAns getIAns() { +        return IAns.Stub.asInterface(ServiceManager.getService("ians")); +    } +      //      //      // PhoneStateListener @@ -5374,7 +5387,7 @@ public class TelephonyManager {      @UnsupportedAppUsage      public static String getTelephonyProperty(String property, String defaultVal) {          String propVal = SystemProperties.get(property); -        return propVal == null ? defaultVal : propVal; +        return TextUtils.isEmpty(propVal) ? defaultVal : propVal;      }      /** @hide */ @@ -8603,7 +8616,6 @@ public class TelephonyManager {          return UNKNOWN_CARRIER_ID_LIST_VERSION;      } -      /**       * How many modems can have simultaneous data connections.       * @hide @@ -8621,4 +8633,62 @@ public class TelephonyManager {          }          return 0;      } + +    /** +     * Enable or disable AlternativeNetworkService. +     * +     * This method should be called to enable or disable +     * AlternativeNetwork service on the device. +     * +     * <p> +     * Requires Permission: +     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} +     * +     * @param enable enable(True) or disable(False) +     * @return returns true if successfully set. +     * @hide +     */ +    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) +    public boolean setAlternativeNetworkState(boolean enable) { +        String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>"; +        boolean ret = false; +        try { +            IAns iAlternativeNetworkService = getIAns(); +            if (iAlternativeNetworkService != null) { +                ret = iAlternativeNetworkService.setEnable(enable, pkgForDebug); +            } +        } catch (RemoteException ex) { +            Rlog.e(TAG, "enableAlternativeNetwork RemoteException", ex); +        } + +        return ret; +    } + +    /** +     * is AlternativeNetworkService enabled +     * +     * This method should be called to determine if the AlternativeNetworkService is +     * enabled +     * +     * <p> +     * Requires Permission: +     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} +     * @hide +     */ +    @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) +    public boolean isAlternativeNetworkEnabled() { +        String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>"; +        boolean isEnabled = false; + +        try { +            IAns iAlternativeNetworkService = getIAns(); +            if (iAlternativeNetworkService != null) { +                isEnabled = iAlternativeNetworkService.isEnabled(pkgForDebug); +            } +        } catch (RemoteException ex) { +            Rlog.e(TAG, "enableAlternativeNetwork RemoteException", ex); +        } + +        return isEnabled; +    }  } diff --git a/telephony/java/com/android/internal/telephony/IAns.aidl b/telephony/java/com/android/internal/telephony/IAns.aidl new file mode 100755 index 000000000000..6eb8d666cb1e --- /dev/null +++ b/telephony/java/com/android/internal/telephony/IAns.aidl @@ -0,0 +1,52 @@ +/* + * 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.internal.telephony; + + +interface IAns { + +    /** +    * Enable or disable Alternative Network service. +    * +    * This method should be called to enable or disable +    * AlternativeNetwork service on the device. +    * +    * <p> +    * Requires Permission: +    *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} +    * Or the calling app has carrier privileges. @see #hasCarrierPrivileges +    * +    * @param enable enable(True) or disable(False) +    * @param callingPackage caller's package name +    * @return returns true if successfully set. +    */ +    boolean setEnable(boolean enable, String callingPackage); + +    /** +     * is Alternative Network service enabled +     * +     * This method should be called to determine if the Alternative Network service is enabled +    * +    * <p> +    * Requires Permission: +    *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} +    * Or the calling app has carrier privileges. @see #hasCarrierPrivileges +    * +    * @param callingPackage caller's package name +    */ +    boolean isEnabled(String callingPackage); +} diff --git a/test-base/Android.bp b/test-base/Android.bp index 0b8a02a815d9..4d765d3e5f3f 100644 --- a/test-base/Android.bp +++ b/test-base/Android.bp @@ -37,7 +37,8 @@ java_sdk_library {          "junit.framework",      ], -    droiddoc_options: ["stubsourceonly"], +    droiddoc_options: ["-stubsourceonly"], +    metalava_enabled: false,      compile_dex: true,  } diff --git a/test-mock/Android.bp b/test-mock/Android.bp index 5eba01779f46..37158e5fe0b9 100644 --- a/test-mock/Android.bp +++ b/test-mock/Android.bp @@ -26,5 +26,6 @@ java_sdk_library {      ],      srcs_lib_whitelist_pkgs: ["android"], +    metalava_enabled: false,      compile_dex: true,  } diff --git a/test-runner/Android.bp b/test-runner/Android.bp index ea615b920df6..0a0d50cc330c 100644 --- a/test-runner/Android.bp +++ b/test-runner/Android.bp @@ -40,7 +40,8 @@ java_sdk_library {          "junit.textui",      ], -    droiddoc_options: ["stubsourceonly"], +    droiddoc_options: ["-stubsourceonly"], +    metalava_enabled: false,      compile_dex: true  } diff --git a/tests/ActivityTests/Android.mk b/tests/ActivityTests/Android.mk index 4c68c8bb40c2..94294f6b062a 100644 --- a/tests/ActivityTests/Android.mk +++ b/tests/ActivityTests/Android.mk @@ -10,9 +10,5 @@ LOCAL_MODULE_TAGS := tests  LOCAL_CERTIFICATE := platform  LOCAL_USE_AAPT2 := true -# Disable AAPT2 manifest checks to fix: -# frameworks/base/tests/ActivityTests/AndroidManifest.xml:42: error: unexpected element <preferred> found in <manifest><application><activity>. -# TODO(b/79755007): Remove when AAPT2 recognizes the manifest elements. -LOCAL_AAPT_FLAGS += --warn-manifest-validation  include $(BUILD_PACKAGE) diff --git a/tests/NetworkSecurityConfigTest/Android.mk b/tests/NetworkSecurityConfigTest/Android.mk index c225e170c377..a6c21db16846 100644 --- a/tests/NetworkSecurityConfigTest/Android.mk +++ b/tests/NetworkSecurityConfigTest/Android.mk @@ -7,7 +7,6 @@ LOCAL_CERTIFICATE := platform  LOCAL_JAVA_LIBRARIES := \      android.test.runner \ -    conscrypt \      android.test.base \  LOCAL_STATIC_JAVA_LIBRARIES := junit diff --git a/tests/RemoteDisplayProvider/Android.mk b/tests/RemoteDisplayProvider/Android.mk index e827ec20ae3e..43bf0243b55b 100644 --- a/tests/RemoteDisplayProvider/Android.mk +++ b/tests/RemoteDisplayProvider/Android.mk @@ -18,9 +18,9 @@ LOCAL_PATH := $(call my-dir)  include $(CLEAR_VARS)  LOCAL_PACKAGE_NAME := RemoteDisplayProviderTest  LOCAL_MODULE_TAGS := tests -LOCAL_SDK_VERSION := current +LOCAL_SDK_VERSION := system_current  LOCAL_SRC_FILES := $(call all-java-files-under, src)  LOCAL_RESOURCE_DIR = $(LOCAL_PATH)/res -LOCAL_JAVA_LIBRARIES := com.android.media.remotedisplay.stubs +LOCAL_JAVA_LIBRARIES := com.android.media.remotedisplay  LOCAL_CERTIFICATE := platform  include $(BUILD_PACKAGE) diff --git a/tests/net/Android.mk b/tests/net/Android.mk index 750e2fb6f6b4..132135dc89bc 100644 --- a/tests/net/Android.mk +++ b/tests/net/Android.mk @@ -63,7 +63,8 @@ LOCAL_JNI_SHARED_LIBRARIES := \      libunwindstack \      libutilscallstack \      libziparchive \ -    libz +    libz \ +    netd_aidl_interface-cpp  LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk @@ -92,7 +93,8 @@ LOCAL_SHARED_LIBRARIES := \    liblog \    libcutils \    libnativehelper \ -  libnetdaidl +  libnetdaidl \ +  netd_aidl_interface-cpp  LOCAL_STATIC_LIBRARIES := \    libpcap \ diff --git a/tools/aapt2/link/ManifestFixer.cpp b/tools/aapt2/link/ManifestFixer.cpp index ee4e70288994..7180a9918abe 100644 --- a/tools/aapt2/link/ManifestFixer.cpp +++ b/tools/aapt2/link/ManifestFixer.cpp @@ -252,6 +252,7 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor,    xml::XmlNodeAction component_action;    component_action.Action(RequiredNameIsJavaClassName);    component_action["intent-filter"] = intent_filter_action; +  component_action["preferred"] = intent_filter_action;    component_action["meta-data"] = meta_data_action;    // Manifest actions. @@ -346,6 +347,7 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor,    manifest_action["uses-permission"];    manifest_action["uses-permission-sdk-23"];    manifest_action["permission"]; +  manifest_action["permission"]["meta-data"] = meta_data_action;    manifest_action["permission-tree"];    manifest_action["permission-group"];    manifest_action["uses-configuration"]; @@ -355,6 +357,8 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor,    manifest_action["compatible-screens"];    manifest_action["compatible-screens"]["screen"];    manifest_action["supports-gl-texture"]; +  manifest_action["restrict-update"]; +  manifest_action["package-verifier"];    manifest_action["meta-data"] = meta_data_action;    manifest_action["uses-split"].Action(RequiredNameIsJavaPackage); @@ -376,6 +380,7 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor,    uses_static_library_action.Action(RequiredNameIsJavaPackage);    uses_static_library_action.Action(RequiredAndroidAttribute("version"));    uses_static_library_action.Action(RequiredAndroidAttribute("certDigest")); +  uses_static_library_action["additional-certificate"];    if (options_.debug_mode) {      application_action.Action([&](xml::Element* el) -> bool { @@ -399,6 +404,8 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor,    application_action["provider"]["grant-uri-permission"];    application_action["provider"]["path-permission"]; +  manifest_action["package"] = manifest_action; +    return true;  }  |