diff options
80 files changed, 976 insertions, 633 deletions
| diff --git a/api/current.txt b/api/current.txt index ed9fba774e2a..24d7cb208675 100644 --- a/api/current.txt +++ b/api/current.txt @@ -44071,7 +44071,9 @@ package android.telecom {      method public final void addExistingConnection(android.telecom.PhoneAccountHandle, android.telecom.Connection);      method public final void conferenceRemoteConnections(android.telecom.RemoteConnection, android.telecom.RemoteConnection);      method public final void connectionServiceFocusReleased(); +    method @Nullable public final android.telecom.RemoteConference createRemoteIncomingConference(@Nullable android.telecom.PhoneAccountHandle, @Nullable android.telecom.ConnectionRequest);      method public final android.telecom.RemoteConnection createRemoteIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest); +    method @Nullable public final android.telecom.RemoteConference createRemoteOutgoingConference(@Nullable android.telecom.PhoneAccountHandle, @Nullable android.telecom.ConnectionRequest);      method public final android.telecom.RemoteConnection createRemoteOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);      method public final java.util.Collection<android.telecom.Conference> getAllConferences();      method public final java.util.Collection<android.telecom.Connection> getAllConnections(); @@ -44302,6 +44304,7 @@ package android.telecom {    public final class RemoteConnection {      method public void abort(); +    method public void addConferenceParticipants(@NonNull java.util.List<android.net.Uri>);      method public void answer();      method public void disconnect();      method public android.net.Uri getAddress(); @@ -63067,7 +63070,7 @@ package java.lang.reflect {  package java.math { -  public class BigDecimal extends java.lang.Number implements java.lang.Comparable<java.math.BigDecimal> java.io.Serializable { +  public class BigDecimal extends java.lang.Number implements java.lang.Comparable<java.math.BigDecimal> {      ctor public BigDecimal(char[], int, int);      ctor public BigDecimal(char[], int, int, java.math.MathContext);      ctor public BigDecimal(char[]); @@ -63154,19 +63157,20 @@ package java.math {      field public static final java.math.BigDecimal ZERO;    } -  public class BigInteger extends java.lang.Number implements java.lang.Comparable<java.math.BigInteger> java.io.Serializable { +  public class BigInteger extends java.lang.Number implements java.lang.Comparable<java.math.BigInteger> { +    ctor public BigInteger(byte[]); +    ctor public BigInteger(int, byte[]); +    ctor public BigInteger(@NonNull String, int); +    ctor public BigInteger(@NonNull String);      ctor public BigInteger(int, @NonNull java.util.Random);      ctor public BigInteger(int, int, @NonNull java.util.Random); -    ctor public BigInteger(@NonNull String); -    ctor public BigInteger(@NonNull String, int); -    ctor public BigInteger(int, byte[]); -    ctor public BigInteger(byte[]);      method @NonNull public java.math.BigInteger abs();      method @NonNull public java.math.BigInteger add(@NonNull java.math.BigInteger);      method @NonNull public java.math.BigInteger and(@NonNull java.math.BigInteger);      method @NonNull public java.math.BigInteger andNot(@NonNull java.math.BigInteger);      method public int bitCount();      method public int bitLength(); +    method public byte byteValueExact();      method @NonNull public java.math.BigInteger clearBit(int);      method public int compareTo(@NonNull java.math.BigInteger);      method @NonNull public java.math.BigInteger divide(@NonNull java.math.BigInteger); @@ -63177,8 +63181,10 @@ package java.math {      method @NonNull public java.math.BigInteger gcd(@NonNull java.math.BigInteger);      method public int getLowestSetBit();      method public int intValue(); +    method public int intValueExact();      method public boolean isProbablePrime(int);      method public long longValue(); +    method public long longValueExact();      method @NonNull public java.math.BigInteger max(@NonNull java.math.BigInteger);      method @NonNull public java.math.BigInteger min(@NonNull java.math.BigInteger);      method @NonNull public java.math.BigInteger mod(@NonNull java.math.BigInteger); @@ -63195,6 +63201,7 @@ package java.math {      method @NonNull public java.math.BigInteger setBit(int);      method @NonNull public java.math.BigInteger shiftLeft(int);      method @NonNull public java.math.BigInteger shiftRight(int); +    method public short shortValueExact();      method public int signum();      method @NonNull public java.math.BigInteger subtract(@NonNull java.math.BigInteger);      method public boolean testBit(int); diff --git a/api/module-lib-current.txt b/api/module-lib-current.txt index cacc950aca05..5bc10ece4db5 100644 --- a/api/module-lib-current.txt +++ b/api/module-lib-current.txt @@ -56,6 +56,7 @@ package android.os {    }    public interface Parcelable { +    method public default int getStability();      field public static final int PARCELABLE_STABILITY_LOCAL = 0; // 0x0      field public static final int PARCELABLE_STABILITY_VINTF = 1; // 0x1    } diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 7745677c4355..b8de3f0eff75 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -365,6 +365,7 @@ message Atom {          NetworkDhcpRenewReported network_dhcp_renew_reported = 291 [(log_from_module) = "network_stack"];          NetworkValidationReported network_validation_reported = 292 [(log_from_module) = "network_stack"];          NetworkStackQuirkReported network_stack_quirk_reported = 293 [(log_from_module) = "network_stack"]; +        KeystoreKeyEventReported keystore_key_event_reported = 302;          NetworkTetheringReported  network_tethering_reported = 303 [(log_from_module) =  "network_tethering"];      } @@ -7903,3 +7904,111 @@ message SupportedRadioAccessFamily {      // See android.telephony.TelephonyManager.NetworkTypeBitMask.      optional int64 network_type_bitmask = 1;  } + +/** + * Logs: i) creation of different types of cryptographic keys in the keystore, + * ii) operations performed using the keys, + * iii) attestation of the keys + * Logged from: system/security/keystore/key_event_log_handler.cpp + */ +message KeystoreKeyEventReported { + +    enum Algorithm { +        /** Asymmetric algorithms. */ +        RSA = 1; +        // 2 removed, do not reuse. +        EC = 3; +        /** Block cipher algorithms */ +        AES = 32; +        TRIPLE_DES = 33; +        /** MAC algorithms */ +        HMAC = 128; +    }; +    /** Algorithm associated with the key */ +    optional Algorithm algorithm = 1; + +    /** Size of the key */ +    optional int32 key_size = 2; + +    enum KeyOrigin { +        /** Generated in keymaster.  Should not exist outside the TEE. */ +        GENERATED = 0; +        /** Derived inside keymaster.  Likely exists off-device. */ +        DERIVED = 1; +        /** Imported into keymaster.  Existed as cleartext in Android. */ +        IMPORTED = 2; +        /** Keymaster did not record origin. */ +        UNKNOWN = 3; +        /** Securely imported into Keymaster. */ +        SECURELY_IMPORTED = 4; +    }; +    /* Logs whether the key was generated, imported, securely imported, or derived.*/ +    optional KeyOrigin key_origin = 3; + +    enum HardwareAuthenticatorType { +        NONE = 0; +        PASSWORD = 1; +        FINGERPRINT = 2; +        // Additional entries must be powers of 2. +    }; +    /** +     * What auth types does this key require? If none, +     * then no auth required. +     */ +    optional HardwareAuthenticatorType user_auth_type = 4; + +    /** +     * If user authentication is required, is the requirement time based? If it +     * is not time based then this field will not be used and the key is per +     * operation. Per operation keys must be user authenticated on each usage. +     */ +    optional int32 user_auth_key_timeout_secs = 5; + +    /** +     * padding mode, digest, block_mode and purpose should ideally be repeated +     * fields. However, since statsd does not support repeated fields in +     * pushed atoms, they are represented using bitmaps. +     */ + +    /** Track which padding mode is being used.*/ +    optional int32 padding_mode_bitmap = 6; + +    /** Track which digest is being used. */ +    optional int32 digest_bitmap = 7; + +    /** Track what block mode is being used (for encryption). */ +    optional int32 block_mode_bitmap = 8; + +    /** Track what purpose is this key serving. */ +    optional int32 purpose_bitmap = 9; + +    enum EcCurve { +        P_224 = 0; +        P_256 = 1; +        P_384 = 2; +        P_521 = 3; +    }; +    /** Which ec curve was selected if elliptic curve cryptography is in use **/ +    optional EcCurve ec_curve = 10; + +    enum KeyBlobUsageRequirements { +        STANDALONE = 0; +        REQUIRES_FILE_SYSTEM = 1; +    }; +    /** Standalone or is a file system required */ +    optional KeyBlobUsageRequirements key_blob_usage_reqs = 11; + +    enum Type { +        KEY_OPERATION = 0; +        KEY_CREATION = 1; +        KEY_ATTESTATION = 2; +    } +    /** Key creation event, operation event or attestation event? */ +    optional Type type = 12; + +    /** Was the key creation, operation, or attestation successful? */ +    optional bool was_successful = 13; + +    /** Response code or error code */ +    optional int32 error_code = 14; +} diff --git a/config/boot-image-profile.txt b/config/boot-image-profile.txt index 773942c8b753..1eb7c066c942 100644 --- a/config/boot-image-profile.txt +++ b/config/boot-image-profile.txt @@ -27036,6 +27036,35 @@ HSPLjava/math/BigInteger;-><init>([B)V  HSPLjava/math/BigInteger;->abs()Ljava/math/BigInteger;  HSPLjava/math/BigInteger;->add(Ljava/math/BigInteger;)Ljava/math/BigInteger;  HSPLjava/math/BigInteger;->bitLength()I +#Temporary manual additions to avoid slowing tests down too much +#Carefully positioned for clean merge +HSPLjava/math/BigInteger;->add([IJ)[I +HSPLjava/math/BigInteger;->add([I[I)[I +HSPLjava/math/BigInteger;->subtract([IJ)[I +HSPLjava/math/BigInteger;->subtract([I[I)[I +HSPLjava/math/BigInteger;->jacobiSymbol(ILjava/math/BigInteger;)I +HSPLjava/math/BigInteger;->lucasLehmerSequence(ILjava/math/BigInteger;Ljava/math/BigInteger;)Ljava/math/BigInteger; +HSPLjava/math/BigInteger;->multiplyToLen([II[II[I)[I +HSPLjava/math/MutableBigInteger;->add(Ljava/math/MutableBigInteger;)V +HSPLjava/math/MutableBigInteger;->addShifted(Ljava/math/MutableBigInteger;)V +HSPLjava/math/MutableBigInteger;->subtract(Ljava/math/MutableBigInteger;)V +HSPLjava/math/MutableBigInteger;->difference(Ljava/math/MutableBigInteger;)V +HSPLjava/math/MutableBigInteger;->divideKnuth(Ljava/math/MutableBigInteger;Ljava/math/MutableBigInteger;Z)Ljava/math/MutableBigInteger; +HSPLjava/math/MutableBigInteger;->divideMagnitude(Ljava/math/MutableBigInteger;Ljava/math/MutableBigInteger;Z)Ljava/math/MutableBigInteger; +HSPLjava/math/MutableBigInteger;->divideLongMagnitude(JLjava/math/MutableBigInteger;)Ljava/math/MutableBigInteger; +HSPLjava/math/MutableBigInteger;->divideOneWord(ILjava/math/MutableBigInteger;)I +HSPLjava/math/MutableBigInteger;->divadd([I[II)I +HSPLjava/math/MutableBigInteger;->mulsub([I[IIII)I +HSPLjava/math/MutableBigInteger;->mulsubBorrow([I[IIII)I +HSPLjava/math/MutableBigInteger;->copyAndShift([III[III)V +HSPLjava/math/MutableBigInteger;->multiply(Ljava/math/MutableBigInteger;Ljava/math/MutableBigInteger;)V +HSPLjava/math/MutableBigInteger;->mul(ILjava/math/MutableBigInteger;)V +HSPLjava/math/MutableBigInteger;->multiply(ILjava/math/MutableBigInteger;)V +HSPLjava/math/MutableBigInteger;->primitiveRightShift(I)I +HSPLjava/math/MutableBigInteger;->primitiveLeftShift(I)I +HSPLjava/math/MutableBigInteger;->binaryGCD(Ljava/math/MutableBigInteger;)Ljava/math/MutableBigInteger; +HSPLjava/math/MutableBigInteger;->binaryGCD(II)I +#End of maual additions  HSPLjava/math/BigInteger;->compareTo(Ljava/math/BigInteger;)I  HSPLjava/math/BigInteger;->divide(Ljava/math/BigInteger;)Ljava/math/BigInteger;  HSPLjava/math/BigInteger;->divideAndRemainder(Ljava/math/BigInteger;)[Ljava/math/BigInteger; diff --git a/core/java/android/os/Parcelable.java b/core/java/android/os/Parcelable.java index 3d3759e695e0..f14f66b07630 100644 --- a/core/java/android/os/Parcelable.java +++ b/core/java/android/os/Parcelable.java @@ -161,6 +161,7 @@ public interface Parcelable {       * @return true if this parcelable is stable.       * @hide       */ +    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)      default @Stability int getStability() {          return PARCELABLE_STABILITY_LOCAL;      } diff --git a/core/java/android/view/ImeInsetsSourceConsumer.java b/core/java/android/view/ImeInsetsSourceConsumer.java index 83abf1a33b2d..749e93972602 100644 --- a/core/java/android/view/ImeInsetsSourceConsumer.java +++ b/core/java/android/view/ImeInsetsSourceConsumer.java @@ -61,7 +61,7 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {      }      public void onServedEditorChanged(EditorInfo info) { -        if (isDummyOrEmptyEditor(info)) { +        if (isFallbackOrEmptyEditor(info)) {              mShowOnNextImeRender = false;          }          mFocusedEditor = info; @@ -112,15 +112,15 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {          getImm().notifyImeHidden();      } -    private boolean isDummyOrEmptyEditor(EditorInfo info) { -        // TODO(b/123044812): Handle dummy input gracefully in IME Insets API +    private boolean isFallbackOrEmptyEditor(EditorInfo info) { +        // TODO(b/123044812): Handle fallback input gracefully in IME Insets API          return info == null || (info.fieldId <= 0 && info.inputType <= 0);      }      private boolean isServedEditorRendered() {          if (mFocusedEditor == null || mPreRenderedEditor == null -                || isDummyOrEmptyEditor(mFocusedEditor) -                || isDummyOrEmptyEditor(mPreRenderedEditor)) { +                || isFallbackOrEmptyEditor(mFocusedEditor) +                || isFallbackOrEmptyEditor(mPreRenderedEditor)) {              // No view is focused or ready.              return false;          } diff --git a/core/java/android/view/inputmethod/BaseInputConnection.java b/core/java/android/view/inputmethod/BaseInputConnection.java index 090e19f91e38..a211a1a3d197 100644 --- a/core/java/android/view/inputmethod/BaseInputConnection.java +++ b/core/java/android/view/inputmethod/BaseInputConnection.java @@ -54,7 +54,7 @@ public class BaseInputConnection implements InputConnection {      /** @hide */      protected final InputMethodManager mIMM;      final View mTargetView; -    final boolean mDummyMode; +    final boolean mFallbackMode;      private Object[] mDefaultComposingSpans; @@ -64,14 +64,14 @@ public class BaseInputConnection implements InputConnection {      BaseInputConnection(InputMethodManager mgr, boolean fullEditor) {          mIMM = mgr;          mTargetView = null; -        mDummyMode = !fullEditor; +        mFallbackMode = !fullEditor;      }      public BaseInputConnection(View targetView, boolean fullEditor) {          mIMM = (InputMethodManager)targetView.getContext().getSystemService(                  Context.INPUT_METHOD_SERVICE);          mTargetView = targetView; -        mDummyMode = !fullEditor; +        mFallbackMode = !fullEditor;      }      public static final void removeComposingSpans(Spannable text) { @@ -189,7 +189,7 @@ public class BaseInputConnection implements InputConnection {      /**       * Default implementation replaces any existing composing text with -     * the given text.  In addition, only if dummy mode, a key event is +     * the given text.  In addition, only if fallback mode, a key event is       * sent for the new text and the current editable buffer cleared.       */      public boolean commitText(CharSequence text, int newCursorPosition) { @@ -428,7 +428,7 @@ public class BaseInputConnection implements InputConnection {      /**       * The default implementation removes the composing state from the -     * current editable text.  In addition, only if dummy mode, a key event is +     * current editable text.  In addition, only if fallback mode, a key event is       * sent for the new text and the current editable buffer cleared.       */      public boolean finishComposingText() { @@ -437,7 +437,7 @@ public class BaseInputConnection implements InputConnection {          if (content != null) {              beginBatchEdit();              removeComposingSpans(content); -            // Note: sendCurrentText does nothing unless mDummyMode is set +            // Note: sendCurrentText does nothing unless mFallbackMode is set              sendCurrentText();              endBatchEdit();          } @@ -447,10 +447,10 @@ public class BaseInputConnection implements InputConnection {      /**       * The default implementation uses TextUtils.getCapsMode to get the       * cursor caps mode for the current selection position in the editable -     * text, unless in dummy mode in which case 0 is always returned. +     * text, unless in fallback mode in which case 0 is always returned.       */      public int getCursorCapsMode(int reqModes) { -        if (mDummyMode) return 0; +        if (mFallbackMode) return 0;          final Editable content = getEditable();          if (content == null) return 0; @@ -647,7 +647,7 @@ public class BaseInputConnection implements InputConnection {              content.setSpan(COMPOSING, a, b,                      Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | Spanned.SPAN_COMPOSING); -            // Note: sendCurrentText does nothing unless mDummyMode is set +            // Note: sendCurrentText does nothing unless mFallbackMode is set              sendCurrentText();              endBatchEdit();          } @@ -698,7 +698,7 @@ public class BaseInputConnection implements InputConnection {      }      private void sendCurrentText() { -        if (!mDummyMode) { +        if (!mFallbackMode) {              return;          } diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index e130eb22fc2a..2ea8b84eb3b3 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -934,7 +934,7 @@ public class ChooserActivity extends ResolverActivity {          final ComponentName cn = getNearbySharingComponent();          if (cn == null) return null; -        final Intent resolveIntent = new Intent(); +        final Intent resolveIntent = new Intent(originalIntent);          resolveIntent.setComponent(cn);          final ResolveInfo ri = getPackageManager().resolveActivity(                  resolveIntent, PackageManager.GET_META_DATA); @@ -1101,6 +1101,13 @@ public class ChooserActivity extends ResolverActivity {              ViewGroup parent) {          ViewGroup contentPreviewLayout = (ViewGroup) layoutInflater.inflate(                  R.layout.chooser_grid_preview_image, parent, false); + + +        final ViewGroup actionRow = +               (ViewGroup) contentPreviewLayout.findViewById(R.id.chooser_action_row); +        //TODO: addActionButton(actionRow, createCopyButton()); +        addActionButton(actionRow, createNearbyButton(targetIntent)); +          mPreviewCoord = new ContentPreviewCoordinator(contentPreviewLayout, true);          String action = targetIntent.getAction(); @@ -1211,10 +1218,10 @@ public class ChooserActivity extends ResolverActivity {          ViewGroup contentPreviewLayout = (ViewGroup) layoutInflater.inflate(                  R.layout.chooser_grid_preview_file, parent, false); -        // TODO(b/120417119): Disable file copy until after moving to sysui, -        // due to permissions issues -        //((ViewGroup) contentPreviewLayout.findViewById(R.id.chooser_action_row)) -        //        .addView(createCopyButton()); +        final ViewGroup actionRow = +                (ViewGroup) contentPreviewLayout.findViewById(R.id.chooser_action_row); +        //TODO(b/120417119): addActionButton(actionRow, createCopyButton()); +        addActionButton(actionRow, createNearbyButton(targetIntent));          String action = targetIntent.getAction();          if (Intent.ACTION_SEND.equals(action)) { diff --git a/core/res/res/values-mcc310-mnc030/config.xml b/core/res/res/values-mcc310-mnc030/config.xml deleted file mode 100644 index 26b9192e0cc3..000000000000 --- a/core/res/res/values-mcc310-mnc030/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2019, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -**     http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<!-- These resources are around just to allow their values to be customized -     for different hardware and product builds. --> -<resources> -    <!-- Enable 5 bar signal strength icon --> -    <bool name="config_inflateSignalStrength">true</bool> -</resources> - diff --git a/core/res/res/values-mcc310-mnc070/config.xml b/core/res/res/values-mcc310-mnc070/config.xml deleted file mode 100644 index 26b9192e0cc3..000000000000 --- a/core/res/res/values-mcc310-mnc070/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2019, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -**     http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<!-- These resources are around just to allow their values to be customized -     for different hardware and product builds. --> -<resources> -    <!-- Enable 5 bar signal strength icon --> -    <bool name="config_inflateSignalStrength">true</bool> -</resources> - diff --git a/core/res/res/values-mcc310-mnc170/config.xml b/core/res/res/values-mcc310-mnc170/config.xml index 12e448cd6b21..f6cddc9bb2a3 100644 --- a/core/res/res/values-mcc310-mnc170/config.xml +++ b/core/res/res/values-mcc310-mnc170/config.xml @@ -20,9 +20,6 @@  <!-- These resources are around just to allow their values to be customized       for different hardware and product builds. -->  <resources> -    <!-- Enable 5 bar signal strength icon --> -    <bool name="config_inflateSignalStrength">true</bool> -      <!-- Boolean indicating whether frameworks needs to reset cell broadcast geo-fencing           check after reboot or airplane mode toggling -->      <bool translatable="false" name="reset_geo_fencing_check_after_boot_or_apm">true</bool> diff --git a/core/res/res/values-mcc310-mnc280/config.xml b/core/res/res/values-mcc310-mnc280/config.xml deleted file mode 100644 index 26b9192e0cc3..000000000000 --- a/core/res/res/values-mcc310-mnc280/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2019, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -**     http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<!-- These resources are around just to allow their values to be customized -     for different hardware and product builds. --> -<resources> -    <!-- Enable 5 bar signal strength icon --> -    <bool name="config_inflateSignalStrength">true</bool> -</resources> - diff --git a/core/res/res/values-mcc310-mnc380/config.xml b/core/res/res/values-mcc310-mnc380/config.xml index 12e448cd6b21..f6cddc9bb2a3 100644 --- a/core/res/res/values-mcc310-mnc380/config.xml +++ b/core/res/res/values-mcc310-mnc380/config.xml @@ -20,9 +20,6 @@  <!-- These resources are around just to allow their values to be customized       for different hardware and product builds. -->  <resources> -    <!-- Enable 5 bar signal strength icon --> -    <bool name="config_inflateSignalStrength">true</bool> -      <!-- Boolean indicating whether frameworks needs to reset cell broadcast geo-fencing           check after reboot or airplane mode toggling -->      <bool translatable="false" name="reset_geo_fencing_check_after_boot_or_apm">true</bool> diff --git a/core/res/res/values-mcc310-mnc410/config.xml b/core/res/res/values-mcc310-mnc410/config.xml index 22b8fefcecf4..6943bd443cdc 100644 --- a/core/res/res/values-mcc310-mnc410/config.xml +++ b/core/res/res/values-mcc310-mnc410/config.xml @@ -49,9 +49,6 @@          <item>"#9"</item>      </string-array> -    <!-- Enable 5 bar signal strength icon --> -    <bool name="config_inflateSignalStrength">true</bool> -      <!-- Boolean indicating whether frameworks needs to reset cell broadcast geo-fencing           check after reboot or airplane mode toggling -->      <bool translatable="false" name="reset_geo_fencing_check_after_boot_or_apm">true</bool> diff --git a/core/res/res/values-mcc310-mnc560/config.xml b/core/res/res/values-mcc310-mnc560/config.xml index 12e448cd6b21..f6cddc9bb2a3 100644 --- a/core/res/res/values-mcc310-mnc560/config.xml +++ b/core/res/res/values-mcc310-mnc560/config.xml @@ -20,9 +20,6 @@  <!-- These resources are around just to allow their values to be customized       for different hardware and product builds. -->  <resources> -    <!-- Enable 5 bar signal strength icon --> -    <bool name="config_inflateSignalStrength">true</bool> -      <!-- Boolean indicating whether frameworks needs to reset cell broadcast geo-fencing           check after reboot or airplane mode toggling -->      <bool translatable="false" name="reset_geo_fencing_check_after_boot_or_apm">true</bool> diff --git a/core/res/res/values-mcc310-mnc950/config.xml b/core/res/res/values-mcc310-mnc950/config.xml deleted file mode 100644 index 26b9192e0cc3..000000000000 --- a/core/res/res/values-mcc310-mnc950/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2019, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -**     http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<!-- These resources are around just to allow their values to be customized -     for different hardware and product builds. --> -<resources> -    <!-- Enable 5 bar signal strength icon --> -    <bool name="config_inflateSignalStrength">true</bool> -</resources> - diff --git a/core/res/res/values-mcc311-mnc180/config.xml b/core/res/res/values-mcc311-mnc180/config.xml index 12e448cd6b21..f6cddc9bb2a3 100644 --- a/core/res/res/values-mcc311-mnc180/config.xml +++ b/core/res/res/values-mcc311-mnc180/config.xml @@ -20,9 +20,6 @@  <!-- These resources are around just to allow their values to be customized       for different hardware and product builds. -->  <resources> -    <!-- Enable 5 bar signal strength icon --> -    <bool name="config_inflateSignalStrength">true</bool> -      <!-- Boolean indicating whether frameworks needs to reset cell broadcast geo-fencing           check after reboot or airplane mode toggling -->      <bool translatable="false" name="reset_geo_fencing_check_after_boot_or_apm">true</bool> diff --git a/core/res/res/values-mcc311-mnc480/config.xml b/core/res/res/values-mcc311-mnc480/config.xml index 336e30e45b00..db2f8d01f93a 100755 --- a/core/res/res/values-mcc311-mnc480/config.xml +++ b/core/res/res/values-mcc311-mnc480/config.xml @@ -40,7 +40,4 @@      <bool name="config_use_sim_language_file">true</bool> -    <!-- Enable 5 bar signal strength icon --> -    <bool name="config_inflateSignalStrength">true</bool> -  </resources> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index d07dd8dabf3e..c7c3ea798bb5 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -4351,10 +4351,6 @@      only. The component must be part of a system app. -->      <string name="config_defaultSupervisionProfileOwnerComponent" translatable="false"></string> -    <!-- Whether to artificially interpret all signal strengths as -         one bar higher than they actually are --> -    <bool name="config_inflateSignalStrength">false</bool> -      <!-- Contains a blacklist of apps that should not get pre-installed carrier app permission           grants, even if the UICC claims that the app should be privileged. See b/138150105 -->      <string-array name="config_restrictedPreinstalledCarrierApps" translatable="false"/> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 6ee965858983..7bd18c3a0e32 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3860,7 +3860,6 @@    <java-symbol type="color" name="decor_view_status_guard_light" />    <java-symbol type="string" name="config_defaultSupervisionProfileOwnerComponent" /> -  <java-symbol type="bool" name="config_inflateSignalStrength" />    <java-symbol type="array" name="config_restrictedPreinstalledCarrierApps" />    <java-symbol type="array" name="config_highRefreshRateBlacklist" /> diff --git a/core/res/res/xml/power_profile.xml b/core/res/res/xml/power_profile.xml index d8ec72f33ddc..166edca3d046 100644 --- a/core/res/res/xml/power_profile.xml +++ b/core/res/res/xml/power_profile.xml @@ -20,7 +20,7 @@  <device name="Android">    <!-- Most values are the incremental current used by a feature,         in mA (measured at nominal voltage). -       The default values are deliberately incorrect dummy values. +       The default values are deliberately incorrect values.         OEM's must measure and provide actual values before         shipping a device.         Example real-world values are given in comments, but they diff --git a/non-updatable-api/current.txt b/non-updatable-api/current.txt index 05cf625abf48..a495250fff5b 100644 --- a/non-updatable-api/current.txt +++ b/non-updatable-api/current.txt @@ -43927,7 +43927,9 @@ package android.telecom {      method public final void addExistingConnection(android.telecom.PhoneAccountHandle, android.telecom.Connection);      method public final void conferenceRemoteConnections(android.telecom.RemoteConnection, android.telecom.RemoteConnection);      method public final void connectionServiceFocusReleased(); +    method @Nullable public final android.telecom.RemoteConference createRemoteIncomingConference(@Nullable android.telecom.PhoneAccountHandle, @Nullable android.telecom.ConnectionRequest);      method public final android.telecom.RemoteConnection createRemoteIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest); +    method @Nullable public final android.telecom.RemoteConference createRemoteOutgoingConference(@Nullable android.telecom.PhoneAccountHandle, @Nullable android.telecom.ConnectionRequest);      method public final android.telecom.RemoteConnection createRemoteOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);      method public final java.util.Collection<android.telecom.Conference> getAllConferences();      method public final java.util.Collection<android.telecom.Connection> getAllConnections(); @@ -44158,6 +44160,7 @@ package android.telecom {    public final class RemoteConnection {      method public void abort(); +    method public void addConferenceParticipants(@NonNull java.util.List<android.net.Uri>);      method public void answer();      method public void disconnect();      method public android.net.Uri getAddress(); @@ -62923,7 +62926,7 @@ package java.lang.reflect {  package java.math { -  public class BigDecimal extends java.lang.Number implements java.lang.Comparable<java.math.BigDecimal> java.io.Serializable { +  public class BigDecimal extends java.lang.Number implements java.lang.Comparable<java.math.BigDecimal> {      ctor public BigDecimal(char[], int, int);      ctor public BigDecimal(char[], int, int, java.math.MathContext);      ctor public BigDecimal(char[]); @@ -63010,19 +63013,20 @@ package java.math {      field public static final java.math.BigDecimal ZERO;    } -  public class BigInteger extends java.lang.Number implements java.lang.Comparable<java.math.BigInteger> java.io.Serializable { +  public class BigInteger extends java.lang.Number implements java.lang.Comparable<java.math.BigInteger> { +    ctor public BigInteger(byte[]); +    ctor public BigInteger(int, byte[]); +    ctor public BigInteger(@NonNull String, int); +    ctor public BigInteger(@NonNull String);      ctor public BigInteger(int, @NonNull java.util.Random);      ctor public BigInteger(int, int, @NonNull java.util.Random); -    ctor public BigInteger(@NonNull String); -    ctor public BigInteger(@NonNull String, int); -    ctor public BigInteger(int, byte[]); -    ctor public BigInteger(byte[]);      method @NonNull public java.math.BigInteger abs();      method @NonNull public java.math.BigInteger add(@NonNull java.math.BigInteger);      method @NonNull public java.math.BigInteger and(@NonNull java.math.BigInteger);      method @NonNull public java.math.BigInteger andNot(@NonNull java.math.BigInteger);      method public int bitCount();      method public int bitLength(); +    method public byte byteValueExact();      method @NonNull public java.math.BigInteger clearBit(int);      method public int compareTo(@NonNull java.math.BigInteger);      method @NonNull public java.math.BigInteger divide(@NonNull java.math.BigInteger); @@ -63033,8 +63037,10 @@ package java.math {      method @NonNull public java.math.BigInteger gcd(@NonNull java.math.BigInteger);      method public int getLowestSetBit();      method public int intValue(); +    method public int intValueExact();      method public boolean isProbablePrime(int);      method public long longValue(); +    method public long longValueExact();      method @NonNull public java.math.BigInteger max(@NonNull java.math.BigInteger);      method @NonNull public java.math.BigInteger min(@NonNull java.math.BigInteger);      method @NonNull public java.math.BigInteger mod(@NonNull java.math.BigInteger); @@ -63051,6 +63057,7 @@ package java.math {      method @NonNull public java.math.BigInteger setBit(int);      method @NonNull public java.math.BigInteger shiftLeft(int);      method @NonNull public java.math.BigInteger shiftRight(int); +    method public short shortValueExact();      method public int signum();      method @NonNull public java.math.BigInteger subtract(@NonNull java.math.BigInteger);      method public boolean testBit(int); diff --git a/non-updatable-api/module-lib-current.txt b/non-updatable-api/module-lib-current.txt index 02827139f0c9..df45c9ec1dee 100644 --- a/non-updatable-api/module-lib-current.txt +++ b/non-updatable-api/module-lib-current.txt @@ -16,6 +16,7 @@ package android.os {    }    public interface Parcelable { +    method public default int getStability();      field public static final int PARCELABLE_STABILITY_LOCAL = 0; // 0x0      field public static final int PARCELABLE_STABILITY_VINTF = 1; // 0x1    } diff --git a/packages/CarSystemUI/Android.bp b/packages/CarSystemUI/Android.bp index 68da999ae786..e937a51c5b21 100644 --- a/packages/CarSystemUI/Android.bp +++ b/packages/CarSystemUI/Android.bp @@ -48,7 +48,7 @@ android_library {          "androidx.lifecycle_lifecycle-extensions",          "SystemUI-tags",          "SystemUI-proto", -        "dagger2-2.19", +        "dagger2",          "//external/kotlinc:kotlin-annotations",      ], @@ -59,7 +59,7 @@ android_library {      manifest: "AndroidManifest.xml", -    plugins: ["dagger2-compiler-2.19"], +    plugins: ["dagger2-compiler"],  } @@ -100,7 +100,7 @@ android_app {      kotlincflags: ["-Xjvm-default=enable"], -    plugins: ["dagger2-compiler-2.19"], +    plugins: ["dagger2-compiler"],      required: ["privapp_whitelist_com.android.systemui"],  } diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java index df30c248c00c..29015c9a9f68 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java @@ -292,18 +292,12 @@ public class BluetoothEventManager {              CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device);              if (cachedDevice == null) {                  cachedDevice = mDeviceManager.addDevice(device); -                Log.d(TAG, "DeviceFoundHandler created new CachedBluetoothDevice: " -                        + cachedDevice); +                Log.d(TAG, "DeviceFoundHandler created new CachedBluetoothDevice");              } else if (cachedDevice.getBondState() == BluetoothDevice.BOND_BONDED                      && !cachedDevice.getDevice().isConnected()) {                  // Dispatch device add callback to show bonded but                  // not connected devices in discovery mode                  dispatchDeviceAdded(cachedDevice); -                Log.d(TAG, "DeviceFoundHandler found bonded and not connected device:" -                        + cachedDevice); -            } else { -                Log.d(TAG, "DeviceFoundHandler found existing CachedBluetoothDevice:" -                        + cachedDevice);              }              cachedDevice.setRssi(rssi);              cachedDevice.setJustDiscovered(true); diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java index cb34606420ab..f694f0e2a83d 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java @@ -122,8 +122,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>      void onProfileStateChanged(LocalBluetoothProfile profile, int newProfileState) {          if (BluetoothUtils.D) { -            Log.d(TAG, "onProfileStateChanged: profile " + profile + ", device=" + mDevice -                    + ", newProfileState " + newProfileState); +            Log.d(TAG, "onProfileStateChanged: profile " + profile + ", device " +                    + mDevice.getAlias() + ", newProfileState " + newProfileState);          }          if (mLocalAdapter.getState() == BluetoothAdapter.STATE_TURNING_OFF)          { @@ -214,9 +214,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>      }      public void setHiSyncId(long id) { -        if (BluetoothUtils.D) { -            Log.d(TAG, "setHiSyncId: mDevice " + mDevice + ", id " + id); -        }          mHiSyncId = id;      } @@ -562,7 +559,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>          }          if (BluetoothUtils.D) { -            Log.e(TAG, "updating profiles for " + mDevice.getAlias() + ", " + mDevice); +            Log.d(TAG, "updating profiles for " + mDevice.getAlias());              BluetoothClass bluetoothClass = mDevice.getBluetoothClass();              if (bluetoothClass != null) Log.v(TAG, "Class: " + bluetoothClass.toString()); diff --git a/packages/SettingsLib/src/com/android/settingslib/net/SignalStrengthUtil.java b/packages/SettingsLib/src/com/android/settingslib/net/SignalStrengthUtil.java index 246f2ceac87c..e1174fa05ea5 100644 --- a/packages/SettingsLib/src/com/android/settingslib/net/SignalStrengthUtil.java +++ b/packages/SettingsLib/src/com/android/settingslib/net/SignalStrengthUtil.java @@ -17,7 +17,8 @@  package com.android.settingslib.net;  import android.content.Context; -import android.telephony.SubscriptionManager; +import android.os.PersistableBundle; +import android.telephony.CarrierConfigManager;  /**   * Utilities for dealing with signal strength. @@ -28,7 +29,13 @@ public class SignalStrengthUtil {       * bar for the subscription with the given id       */      public static boolean shouldInflateSignalStrength(Context context, int subscriptionId) { -        return SubscriptionManager.getResourcesForSubId(context, subscriptionId) -                .getBoolean(com.android.internal.R.bool.config_inflateSignalStrength); +        final CarrierConfigManager carrierConfigMgr = +                context.getSystemService(CarrierConfigManager.class); +        PersistableBundle bundle = null; +        if (carrierConfigMgr != null) { +            bundle = carrierConfigMgr.getConfigForSubId(subscriptionId); +        } +        return (bundle != null && bundle.getBoolean( +                CarrierConfigManager.KEY_INFLATE_SIGNAL_STRENGTH_BOOL, false));      }  } diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index dbfaca0b6b80..a645dfc7c5ad 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -62,7 +62,7 @@ android_library {          "iconloader_base",          "SystemUI-tags",          "SystemUI-proto", -        "dagger2-2.19", +        "dagger2",          "jsr330"      ],      manifest: "AndroidManifest.xml", @@ -73,7 +73,7 @@ android_library {      kotlincflags: ["-Xjvm-default=enable"], -    plugins: ["dagger2-compiler-2.19"], +    plugins: ["dagger2-compiler"],  }  android_library { @@ -118,7 +118,7 @@ android_library {          "mockito-target-inline-minus-junit4",          "testables",          "truth-prebuilt", -        "dagger2-2.19", +        "dagger2",          "jsr330"      ],      libs: [ @@ -131,7 +131,7 @@ android_library {          "--extra-packages",          "com.android.systemui",      ], -    plugins: ["dagger2-compiler-2.19"], +    plugins: ["dagger2-compiler"],  }  android_app { diff --git a/packages/SystemUI/docs/dagger.md b/packages/SystemUI/docs/dagger.md index c440fba10135..bb68647ceb00 100644 --- a/packages/SystemUI/docs/dagger.md +++ b/packages/SystemUI/docs/dagger.md @@ -206,11 +206,31 @@ public CustomView(@Named(VIEW_CONTEXT) Context themedViewContext, AttributeSet a  ## Updating Dagger2 +We depend on the Dagger source found in external/dagger2. We should automatically pick up on updates +when that repository is updated. + +*Deprecated:* +  Binaries can be downloaded from https://repo1.maven.org/maven2/com/google/dagger/ and then loaded  into  [/prebuilts/tools/common/m2/repository/com/google/dagger/](http://cs/android/prebuilts/tools/common/m2/repository/com/google/dagger/) +The following commands should work, substituting in the version that you are looking for: + +```` +cd prebuilts/tools/common/m2/repository/com/google/dagger/ + +wget -r -np -nH --cut-dirs=4 -erobots=off -R "index.html*" -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" https://repo1.maven.org/maven2/com/google/dagger/dagger/2.28.1/ + +wget -r -np -nH --cut-dirs=4 -erobots=off -R "index.html*" -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" https://repo1.maven.org/maven2/com/google/dagger/dagger-compiler/2.28.1/ + +wget -r -np -nH --cut-dirs=4 -erobots=off -R "index.html*" -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" https://repo1.maven.org/maven2/com/google/dagger/dagger-spi/2.28.1/ + +wget -r -np -nH --cut-dirs=4 -erobots=off -R "index.html*" -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" https://repo1.maven.org/maven2/com/google/dagger/dagger-producers/2.28.1/ +```` +Then update `prebuilts/tools/common/m2/Android.bp` to point at your new jars. +   ## TODO List   - Eliminate usages of Dependency#get diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 3b08ef5fc1e1..e4feaaef5c44 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -1157,7 +1157,6 @@ public class NetworkControllerImpl extends BroadcastReceiver          boolean show4gForLte = false;          boolean hideLtePlus = false;          boolean hspaDataDistinguishable; -        boolean inflateSignalStrengths = false;          boolean alwaysShowDataRatIcon = false;          static Config readConfig(Context context) { @@ -1169,8 +1168,6 @@ public class NetworkControllerImpl extends BroadcastReceiver                      res.getBoolean(com.android.internal.R.bool.config_alwaysUseCdmaRssi);              config.hspaDataDistinguishable =                      res.getBoolean(R.bool.config_hspa_data_distinguishable); -            config.inflateSignalStrengths = res.getBoolean( -                    com.android.internal.R.bool.config_inflateSignalStrength);              CarrierConfigManager configMgr = (CarrierConfigManager)                      context.getSystemService(Context.CARRIER_CONFIG_SERVICE); diff --git a/packages/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java b/packages/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java index 9bb01ae5df1d..64be2d9a5599 100644 --- a/packages/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java +++ b/packages/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java @@ -50,7 +50,7 @@ import androidx.test.InstrumentationRegistry;  import androidx.test.filters.MediumTest;  import androidx.test.runner.AndroidJUnit4; -import com.android.testutils.HandlerUtilsKt; +import com.android.testutils.HandlerUtils;  import com.android.testutils.TapPacketReader;  import org.junit.After; @@ -366,7 +366,7 @@ public class EthernetTetheringTest {      private TapPacketReader makePacketReader(FileDescriptor fd, int mtu) {          final TapPacketReader reader = new TapPacketReader(mHandler, fd, mtu);          mHandler.post(() -> reader.start()); -        HandlerUtilsKt.waitForIdle(mHandler, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mHandler, TIMEOUT_MS);          return reader;      } diff --git a/packages/Tethering/tests/unit/src/android/net/util/TetheringUtilsTest.java b/packages/Tethering/tests/unit/src/android/net/util/TetheringUtilsTest.java index 1499f3be224e..91c7771cc7fe 100644 --- a/packages/Tethering/tests/unit/src/android/net/util/TetheringUtilsTest.java +++ b/packages/Tethering/tests/unit/src/android/net/util/TetheringUtilsTest.java @@ -27,7 +27,7 @@ import android.net.TetheringRequestParcel;  import androidx.test.filters.SmallTest;  import androidx.test.runner.AndroidJUnit4; -import com.android.testutils.MiscAssertsKt; +import com.android.testutils.MiscAsserts;  import org.junit.Before;  import org.junit.Test; @@ -82,6 +82,6 @@ public class TetheringUtilsTest {          request.showProvisioningUi = false;          assertFalse(TetheringUtils.isTetheringRequestEquals(mTetheringRequest, request)); -        MiscAssertsKt.assertFieldCountEquals(5, TetheringRequestParcel.class); +        MiscAsserts.assertFieldCountEquals(5, TetheringRequestParcel.class);      }  } diff --git a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadControllerTest.java b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadControllerTest.java index b291438937c7..ce52ae22ece8 100644 --- a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadControllerTest.java +++ b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadControllerTest.java @@ -30,8 +30,8 @@ import static com.android.networkstack.tethering.OffloadController.StatsType.STA  import static com.android.networkstack.tethering.OffloadController.StatsType.STATS_PER_UID;  import static com.android.networkstack.tethering.OffloadHardwareInterface.ForwardedStats;  import static com.android.networkstack.tethering.TetheringConfiguration.DEFAULT_TETHER_OFFLOAD_POLL_INTERVAL_MS; -import static com.android.testutils.MiscAssertsKt.assertContainsAll; -import static com.android.testutils.MiscAssertsKt.assertThrows; +import static com.android.testutils.MiscAsserts.assertContainsAll; +import static com.android.testutils.MiscAsserts.assertThrows;  import static com.android.testutils.NetworkStatsUtilsKt.assertNetworkStatsEquals;  import static junit.framework.Assert.assertNotNull; diff --git a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringNotificationUpdaterTest.kt b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringNotificationUpdaterTest.kt index 4b6bbac051e0..75c819bb0ced 100644 --- a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringNotificationUpdaterTest.kt +++ b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringNotificationUpdaterTest.kt @@ -18,33 +18,40 @@ package com.android.networkstack.tethering  import android.app.Notification  import android.app.NotificationManager +import android.app.PendingIntent +import android.app.PendingIntent.FLAG_IMMUTABLE  import android.content.Context +import android.content.Intent  import android.content.pm.ActivityInfo  import android.content.pm.ApplicationInfo  import android.content.pm.PackageManager  import android.content.pm.ResolveInfo  import android.content.res.Resources  import android.net.ConnectivityManager.TETHERING_WIFI +import android.net.NetworkCapabilities +import android.net.NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING  import android.os.Handler  import android.os.HandlerThread  import android.os.Looper -import android.net.NetworkCapabilities -import android.net.NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING  import android.os.UserHandle +import android.provider.Settings  import android.telephony.TelephonyManager  import androidx.test.filters.SmallTest  import androidx.test.platform.app.InstrumentationRegistry  import androidx.test.runner.AndroidJUnit4  import com.android.internal.util.test.BroadcastInterceptingContext +import com.android.networkstack.tethering.TetheringNotificationUpdater.ACTION_DISABLE_TETHERING  import com.android.networkstack.tethering.TetheringNotificationUpdater.DOWNSTREAM_NONE  import com.android.networkstack.tethering.TetheringNotificationUpdater.EVENT_SHOW_NO_UPSTREAM  import com.android.networkstack.tethering.TetheringNotificationUpdater.NO_UPSTREAM_NOTIFICATION_ID  import com.android.networkstack.tethering.TetheringNotificationUpdater.RESTRICTED_NOTIFICATION_ID  import com.android.networkstack.tethering.TetheringNotificationUpdater.ROAMING_NOTIFICATION_ID  import com.android.networkstack.tethering.TetheringNotificationUpdater.VERIZON_CARRIER_ID +import com.android.networkstack.tethering.TetheringNotificationUpdater.getSettingsPackageName  import com.android.testutils.waitForIdle  import org.junit.After  import org.junit.Assert.assertEquals +import org.junit.Assert.assertNotNull  import org.junit.Assert.fail  import org.junit.Before  import org.junit.Test @@ -87,12 +94,17 @@ class TetheringNotificationUpdaterTest {      // every test but should always be initialized before use (or the test should crash).      private lateinit var context: TestContext      private lateinit var notificationUpdater: TetheringNotificationUpdater + +    // Initializing the following members depends on initializing some of the mocks and +    // is more logically done in setup().      private lateinit var fakeTetheringThread: HandlerThread      private val ROAMING_CAPABILITIES = NetworkCapabilities()      private val HOME_CAPABILITIES = NetworkCapabilities().addCapability(NET_CAPABILITY_NOT_ROAMING)      private val NOTIFICATION_ICON_ID = R.drawable.stat_sys_tether_general      private val TIMEOUT_MS = 500L +    private val ACTIVITY_PENDING_INTENT = 0 +    private val BROADCAST_PENDING_INTENT = 1      private inner class TestContext(c: Context) : BroadcastInterceptingContext(c) {          override fun createContextAsUser(user: UserHandle, flags: Int) = @@ -146,10 +158,43 @@ class TetheringNotificationUpdaterTest {          fakeTetheringThread.quitSafely()      } +    private fun verifyActivityPendingIntent(intent: Intent, flags: Int) { +        // Use FLAG_NO_CREATE to verify whether PendingIntent has FLAG_IMMUTABLE flag(forcefully add +        // the flag in creating arguments). If the described PendingIntent does not already exist, +        // getActivity() will return null instead of PendingIntent object. +        val pi = PendingIntent.getActivity( +                context.createContextAsUser(UserHandle.CURRENT, 0 /* flags */), +                0 /* requestCode */, +                intent, +                flags or FLAG_IMMUTABLE or PendingIntent.FLAG_NO_CREATE, +                null /* options */) +        assertNotNull("Activity PendingIntent with FLAG_IMMUTABLE does not exist.", pi) +    } + +    private fun verifyBroadcastPendingIntent(intent: Intent, flags: Int) { +        // Use FLAG_NO_CREATE to verify whether PendingIntent has FLAG_IMMUTABLE flag(forcefully add +        // the flag in creating arguments). If the described PendingIntent does not already exist, +        // getBroadcast() will return null instead of PendingIntent object. +        val pi = PendingIntent.getBroadcast( +                context.createContextAsUser(UserHandle.CURRENT, 0 /* flags */), +                0 /* requestCode */, +                intent, +                flags or FLAG_IMMUTABLE or PendingIntent.FLAG_NO_CREATE) +        assertNotNull("Broadcast PendingIntent with FLAG_IMMUTABLE does not exist.", pi) +    } +      private fun Notification.title() = this.extras.getString(Notification.EXTRA_TITLE)      private fun Notification.text() = this.extras.getString(Notification.EXTRA_TEXT) -    private fun verifyNotification(iconId: Int, title: String, text: String, id: Int) { +    private fun verifyNotification( +        iconId: Int, +        title: String, +        text: String, +        id: Int, +        intentSenderType: Int, +        intent: Intent, +        flags: Int +    ) {          verify(notificationManager, never()).cancel(any(), eq(id))          val notificationCaptor = ArgumentCaptor.forClass(Notification::class.java) @@ -161,6 +206,11 @@ class TetheringNotificationUpdaterTest {          assertEquals(title, notification.title())          assertEquals(text, notification.text()) +        when (intentSenderType) { +            ACTIVITY_PENDING_INTENT -> verifyActivityPendingIntent(intent, flags) +            BROADCAST_PENDING_INTENT -> verifyBroadcastPendingIntent(intent, flags) +        } +          reset(notificationManager)      } @@ -176,6 +226,10 @@ class TetheringNotificationUpdaterTest {      @Test      fun testRestrictedNotification() { +        val settingsIntent = Intent(Settings.ACTION_TETHER_SETTINGS) +                .setPackage(getSettingsPackageName(context.packageManager)) +                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) +          // Set test sub id.          notificationUpdater.onActiveDataSubscriptionIdChanged(TEST_SUBID)          verifyNotificationCancelled(listOf(NO_UPSTREAM_NOTIFICATION_ID, ROAMING_NOTIFICATION_ID)) @@ -183,7 +237,7 @@ class TetheringNotificationUpdaterTest {          // User restrictions on. Show restricted notification.          notificationUpdater.notifyTetheringDisabledByRestriction()          verifyNotification(NOTIFICATION_ICON_ID, TEST_DISALLOW_TITLE, TEST_DISALLOW_MESSAGE, -                RESTRICTED_NOTIFICATION_ID) +                RESTRICTED_NOTIFICATION_ID, ACTIVITY_PENDING_INTENT, settingsIntent, FLAG_IMMUTABLE)          // User restrictions off. Clear notification.          notificationUpdater.tetheringRestrictionLifted() @@ -196,7 +250,7 @@ class TetheringNotificationUpdaterTest {          // User restrictions on again. Show restricted notification.          notificationUpdater.notifyTetheringDisabledByRestriction()          verifyNotification(NOTIFICATION_ICON_ID, TEST_DISALLOW_TITLE, TEST_DISALLOW_MESSAGE, -                RESTRICTED_NOTIFICATION_ID) +                RESTRICTED_NOTIFICATION_ID, ACTIVITY_PENDING_INTENT, settingsIntent, FLAG_IMMUTABLE)      }      val MAX_BACKOFF_MS = 200L @@ -234,6 +288,8 @@ class TetheringNotificationUpdaterTest {      @Test      fun testNoUpstreamNotification() { +        val disableIntent = Intent(ACTION_DISABLE_TETHERING).setPackage(context.packageName) +          // Set test sub id.          notificationUpdater.onActiveDataSubscriptionIdChanged(TEST_SUBID)          verifyNotificationCancelled(listOf(NO_UPSTREAM_NOTIFICATION_ID, ROAMING_NOTIFICATION_ID)) @@ -246,7 +302,8 @@ class TetheringNotificationUpdaterTest {          notificationUpdater.onUpstreamCapabilitiesChanged(null)          notificationUpdater.handler.waitForDelayedMessage(EVENT_SHOW_NO_UPSTREAM, TIMEOUT_MS)          verifyNotification(NOTIFICATION_ICON_ID, TEST_NO_UPSTREAM_TITLE, TEST_NO_UPSTREAM_MESSAGE, -                NO_UPSTREAM_NOTIFICATION_ID) +                NO_UPSTREAM_NOTIFICATION_ID, BROADCAST_PENDING_INTENT, disableIntent, +                FLAG_IMMUTABLE)          // Same capabilities changed. Nothing happened.          notificationUpdater.onUpstreamCapabilitiesChanged(null) @@ -260,7 +317,8 @@ class TetheringNotificationUpdaterTest {          notificationUpdater.onUpstreamCapabilitiesChanged(null)          notificationUpdater.handler.waitForDelayedMessage(EVENT_SHOW_NO_UPSTREAM, TIMEOUT_MS)          verifyNotification(NOTIFICATION_ICON_ID, TEST_NO_UPSTREAM_TITLE, TEST_NO_UPSTREAM_MESSAGE, -                NO_UPSTREAM_NOTIFICATION_ID) +                NO_UPSTREAM_NOTIFICATION_ID, BROADCAST_PENDING_INTENT, disableIntent, +                FLAG_IMMUTABLE)          // No downstream.          notificationUpdater.onDownstreamChanged(DOWNSTREAM_NONE) @@ -305,6 +363,11 @@ class TetheringNotificationUpdaterTest {      @Test      fun testRoamingNotification() { +        val disableIntent = Intent(ACTION_DISABLE_TETHERING).setPackage(context.packageName) +        val settingsIntent = Intent(Settings.ACTION_TETHER_SETTINGS) +                .setPackage(getSettingsPackageName(context.packageManager)) +                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) +          // Set test sub id.          notificationUpdater.onActiveDataSubscriptionIdChanged(TEST_SUBID)          verifyNotificationCancelled(listOf(NO_UPSTREAM_NOTIFICATION_ID, ROAMING_NOTIFICATION_ID)) @@ -316,7 +379,7 @@ class TetheringNotificationUpdaterTest {          // Upstream capabilities changed to roaming state. Show roaming notification.          notificationUpdater.onUpstreamCapabilitiesChanged(ROAMING_CAPABILITIES)          verifyNotification(NOTIFICATION_ICON_ID, TEST_ROAMING_TITLE, TEST_ROAMING_MESSAGE, -                ROAMING_NOTIFICATION_ID) +                ROAMING_NOTIFICATION_ID, ACTIVITY_PENDING_INTENT, settingsIntent, FLAG_IMMUTABLE)          // Same capabilities change. Nothing happened.          notificationUpdater.onUpstreamCapabilitiesChanged(ROAMING_CAPABILITIES) @@ -329,14 +392,15 @@ class TetheringNotificationUpdaterTest {          // Upstream capabilities changed to roaming state again. Show roaming notification.          notificationUpdater.onUpstreamCapabilitiesChanged(ROAMING_CAPABILITIES)          verifyNotification(NOTIFICATION_ICON_ID, TEST_ROAMING_TITLE, TEST_ROAMING_MESSAGE, -                ROAMING_NOTIFICATION_ID) +                ROAMING_NOTIFICATION_ID, ACTIVITY_PENDING_INTENT, settingsIntent, FLAG_IMMUTABLE)          // No upstream. Clear roaming notification and show no upstream notification.          notificationUpdater.onUpstreamCapabilitiesChanged(null)          notificationUpdater.handler.waitForDelayedMessage(EVENT_SHOW_NO_UPSTREAM, TIMEOUT_MS)          verifyNotificationCancelled(listOf(ROAMING_NOTIFICATION_ID), false)          verifyNotification(NOTIFICATION_ICON_ID, TEST_NO_UPSTREAM_TITLE, TEST_NO_UPSTREAM_MESSAGE, -                NO_UPSTREAM_NOTIFICATION_ID) +                NO_UPSTREAM_NOTIFICATION_ID, BROADCAST_PENDING_INTENT, disableIntent, +                FLAG_IMMUTABLE)          // No downstream.          notificationUpdater.onDownstreamChanged(DOWNSTREAM_NONE) @@ -347,7 +411,8 @@ class TetheringNotificationUpdaterTest {          notificationUpdater.handler.waitForDelayedMessage(EVENT_SHOW_NO_UPSTREAM, TIMEOUT_MS)          verifyNotificationCancelled(listOf(ROAMING_NOTIFICATION_ID), false)          verifyNotification(NOTIFICATION_ICON_ID, TEST_NO_UPSTREAM_TITLE, TEST_NO_UPSTREAM_MESSAGE, -                NO_UPSTREAM_NOTIFICATION_ID) +                NO_UPSTREAM_NOTIFICATION_ID, BROADCAST_PENDING_INTENT, disableIntent, +                FLAG_IMMUTABLE)          // Set R.bool.config_upstream_roaming_notification to false and change upstream          // network to roaming state again. No roaming notification. @@ -363,8 +428,7 @@ class TetheringNotificationUpdaterTest {          val testSettingsPackageName = "com.android.test.settings"          val pm = mock(PackageManager::class.java)          doReturn(null).`when`(pm).resolveActivity(any(), anyInt()) -        assertEquals(defaultSettingsPackageName, -                TetheringNotificationUpdater.getSettingsPackageName(pm)) +        assertEquals(defaultSettingsPackageName, getSettingsPackageName(pm))          val resolveInfo = ResolveInfo().apply {              activityInfo = ActivityInfo().apply { @@ -375,7 +439,6 @@ class TetheringNotificationUpdaterTest {              }          }          doReturn(resolveInfo).`when`(pm).resolveActivity(any(), anyInt()) -        assertEquals(testSettingsPackageName, -                TetheringNotificationUpdater.getSettingsPackageName(pm)) +        assertEquals(testSettingsPackageName, getSettingsPackageName(pm))      }  } diff --git a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java index fb3940bfbad8..b0586e30f3b0 100644 --- a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java +++ b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java @@ -143,7 +143,7 @@ import com.android.internal.util.ArrayUtils;  import com.android.internal.util.StateMachine;  import com.android.internal.util.test.BroadcastInterceptingContext;  import com.android.internal.util.test.FakeSettingsProvider; -import com.android.testutils.MiscAssertsKt; +import com.android.testutils.MiscAsserts;  import org.junit.After;  import org.junit.AfterClass; @@ -1360,7 +1360,7 @@ public class TetheringTest {          assertEquals(0, parcel.localOnlyList.length);          assertEquals(0, parcel.erroredIfaceList.length);          assertEquals(0, parcel.lastErrorList.length); -        MiscAssertsKt.assertFieldCountEquals(5, TetherStatesParcel.class); +        MiscAsserts.assertFieldCountEquals(5, TetherStatesParcel.class);      }      @Test diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 81bbf68bb081..ecb935edde21 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -4957,7 +4957,7 @@ public class ConnectivityService extends IConnectivityManager.Stub                  Slog.w(TAG, "User " + userId + " has no Vpn configuration");                  return null;              } -            return vpn.getLockdownWhitelist(); +            return vpn.getLockdownAllowlist();          }      } diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java index 6402e07bddc3..b2f0c8376db1 100644 --- a/services/core/java/com/android/server/IpSecService.java +++ b/services/core/java/com/android/server/IpSecService.java @@ -1477,7 +1477,7 @@ public class IpSecService extends IIpSecService.Stub {      }      /** -     * Checks an IpSecConfig parcel to ensure that the contents are sane and throws an +     * Checks an IpSecConfig parcel to ensure that the contents are valid and throws an       * IllegalArgumentException if they are not.       */      private void checkIpSecConfig(IpSecConfig config) { diff --git a/services/core/java/com/android/server/connectivity/PermissionMonitor.java b/services/core/java/com/android/server/connectivity/PermissionMonitor.java index 7202f0f401f9..7f9b3c9fcff7 100644 --- a/services/core/java/com/android/server/connectivity/PermissionMonitor.java +++ b/services/core/java/com/android/server/connectivity/PermissionMonitor.java @@ -56,7 +56,6 @@ import android.system.OsConstants;  import android.util.ArraySet;  import android.util.Log;  import android.util.SparseArray; -import android.util.SparseIntArray;  import com.android.internal.annotations.GuardedBy;  import com.android.internal.annotations.VisibleForTesting; @@ -130,7 +129,42 @@ public class PermissionMonitor implements PackageManagerInternal.PackageListObse          }      } -    public PermissionMonitor(@NonNull final Context context, @NonNull final INetd netd) { +    /** +     * A data class to store each uid Netd permission information. Netd permissions includes +     * PERMISSION_NETWORK, PERMISSION_SYSTEM, PERMISSION_INTERNET, PERMISSION_UPDATE_DEVICE_STATS +     * and OR'd with the others. Default permission is PERMISSION_NONE and PERMISSION_UNINSTALLED +     * will be set if all packages are removed from the uid. +     */ +    public static class UidNetdPermissionInfo { +        private final int mNetdPermissions; + +        UidNetdPermissionInfo() { +            this(PERMISSION_NONE); +        } + +        UidNetdPermissionInfo(int permissions) { +            mNetdPermissions = permissions; +        } + +        /** Plus given permissions and return new UidNetdPermissionInfo instance. */ +        public UidNetdPermissionInfo plusNetdPermissions(int permissions) { +            return new UidNetdPermissionInfo(mNetdPermissions | permissions); +        } + +        /** Return whether package is uninstalled. */ +        public boolean isPackageUninstalled() { +            return mNetdPermissions == PERMISSION_UNINSTALLED; +        } + +        /** Check that uid has given permissions */ +        public boolean hasNetdPermissions(final int permissions) { +            if (isPackageUninstalled()) return false; +            if (permissions == PERMISSION_NONE) return true; +            return (mNetdPermissions & permissions) == permissions; +        } +    } + +    public PermissionMonitor(Context context, INetd netd) {          this(context, netd, new Dependencies());      } @@ -161,7 +195,7 @@ public class PermissionMonitor implements PackageManagerInternal.PackageListObse              return;          } -        SparseIntArray netdPermsUids = new SparseIntArray(); +        final SparseArray<UidNetdPermissionInfo> netdPermsUids = new SparseArray<>();          for (PackageInfo app : apps) {              int uid = app.applicationInfo != null ? app.applicationInfo.uid : INVALID_UID; @@ -183,9 +217,13 @@ public class PermissionMonitor implements PackageManagerInternal.PackageListObse                  }              } +            // Skip already checked uid. +            if (netdPermsUids.get(uid) != null) continue; +              //TODO: unify the management of the permissions into one codepath. -            final int otherNetdPerms = getNetdPermissionMask(uid); -            netdPermsUids.put(uid, netdPermsUids.get(uid) | otherNetdPerms); +            final UidNetdPermissionInfo permInfo = +                    new UidNetdPermissionInfo(getNetdPermissionMask(uid)); +            netdPermsUids.put(uid, permInfo);          }          List<UserInfo> users = mUserManager.getUsers(true);  // exclude dying users @@ -207,7 +245,10 @@ public class PermissionMonitor implements PackageManagerInternal.PackageListObse                          ? PERMISSION_UPDATE_DEVICE_STATS : 0;                  netdPermission |= perms.contains(INTERNET) ? PERMISSION_INTERNET : 0;              } -            netdPermsUids.put(uid, netdPermsUids.get(uid) | netdPermission); +            final UidNetdPermissionInfo permInfo = netdPermsUids.get(uid); +            netdPermsUids.put(uid, permInfo != null +                    ? permInfo.plusNetdPermissions(netdPermission) +                    : new UidNetdPermissionInfo(netdPermission));          }          log("Users: " + mUsers.size() + ", Apps: " + mApps.size());          update(mUsers, mApps, true); @@ -341,15 +382,15 @@ public class PermissionMonitor implements PackageManagerInternal.PackageListObse          return currentPermission;      } -    private int getPermissionForUid(final int uid) { +    private UidNetdPermissionInfo getPermissionForUid(final int uid) {          // Check all the packages for this UID. The UID has the permission if any of the          // packages in it has the permission.          final String[] packages = mPackageManager.getPackagesForUid(uid);          if (packages == null || packages.length <= 0) {              // The last package of this uid is removed from device. Clean the package up. -            return PERMISSION_UNINSTALLED; +            return new UidNetdPermissionInfo(PERMISSION_UNINSTALLED);          } -        return getNetdPermissionMask(uid); +        return new UidNetdPermissionInfo(getNetdPermissionMask(uid));      }      /** @@ -599,28 +640,28 @@ public class PermissionMonitor implements PackageManagerInternal.PackageListObse       * permission information to netd.       *       * @param uid the app uid of the package installed -     * @param permissions the permissions the app requested and netd cares about. +     * @param permissionInfo the permission info of given uid.       *       * @hide       */      @VisibleForTesting -    void sendPackagePermissionsForUid(int uid, int permissions) { -        SparseIntArray netdPermissionsAppIds = new SparseIntArray(); -        netdPermissionsAppIds.put(uid, permissions); -        sendPackagePermissionsToNetd(netdPermissionsAppIds); +    void sendPackagePermissionsForUid(int uid, UidNetdPermissionInfo permissionInfo) { +        final SparseArray<UidNetdPermissionInfo> uidsPermInfo = new SparseArray<>(); +        uidsPermInfo.put(uid, permissionInfo); +        sendPackagePermissionsToNetd(uidsPermInfo);      }      /**       * Called by packageManagerService to send IPC to netd. Grant or revoke the INTERNET       * and/or UPDATE_DEVICE_STATS permission of the uids in array.       * -     * @param netdPermissionsAppIds integer pairs of uids and the permission granted to it. If the -     * permission is 0, revoke all permissions of that uid. -     * +     * @param uidsPermInfo permission info array generated from each uid. If the uid permission is +     *                     PERMISSION_NONE or PERMISSION_UNINSTALLED, revoke all permissions of that +     *                     uid.       * @hide       */      @VisibleForTesting -    void sendPackagePermissionsToNetd(SparseIntArray netdPermissionsAppIds) { +    void sendPackagePermissionsToNetd(final SparseArray<UidNetdPermissionInfo> uidsPermInfo) {          if (mNetd == null) {              Log.e(TAG, "Failed to get the netd service");              return; @@ -630,26 +671,20 @@ public class PermissionMonitor implements PackageManagerInternal.PackageListObse          ArrayList<Integer> updateStatsPermissionAppIds = new ArrayList<>();          ArrayList<Integer> noPermissionAppIds = new ArrayList<>();          ArrayList<Integer> uninstalledAppIds = new ArrayList<>(); -        for (int i = 0; i < netdPermissionsAppIds.size(); i++) { -            int permissions = netdPermissionsAppIds.valueAt(i); -            switch(permissions) { -                case (PERMISSION_INTERNET | PERMISSION_UPDATE_DEVICE_STATS): -                    allPermissionAppIds.add(netdPermissionsAppIds.keyAt(i)); -                    break; -                case PERMISSION_INTERNET: -                    internetPermissionAppIds.add(netdPermissionsAppIds.keyAt(i)); -                    break; -                case PERMISSION_UPDATE_DEVICE_STATS: -                    updateStatsPermissionAppIds.add(netdPermissionsAppIds.keyAt(i)); -                    break; -                case PERMISSION_NONE: -                    noPermissionAppIds.add(netdPermissionsAppIds.keyAt(i)); -                    break; -                case PERMISSION_UNINSTALLED: -                    uninstalledAppIds.add(netdPermissionsAppIds.keyAt(i)); -                default: -                    Log.e(TAG, "unknown permission type: " + permissions + "for uid: " -                            + netdPermissionsAppIds.keyAt(i)); +        for (int i = 0; i < uidsPermInfo.size(); i++) { +            final int uid = uidsPermInfo.keyAt(i); +            final UidNetdPermissionInfo permInfo = uidsPermInfo.valueAt(i); +            if (permInfo.hasNetdPermissions( +                    PERMISSION_INTERNET | PERMISSION_UPDATE_DEVICE_STATS)) { +                allPermissionAppIds.add(uid); +            } else if (permInfo.hasNetdPermissions(PERMISSION_INTERNET)) { +                internetPermissionAppIds.add(uid); +            } else if (permInfo.hasNetdPermissions(PERMISSION_UPDATE_DEVICE_STATS)) { +                updateStatsPermissionAppIds.add(uid); +            } else if (permInfo.isPackageUninstalled()) { +                uninstalledAppIds.add(uid); +            } else { +                noPermissionAppIds.add(uid);              }          }          try { diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java index b5d0dc354443..2c31cd3fd1e0 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -153,8 +153,8 @@ public class Vpn {      private static final boolean LOGD = true;      // Length of time (in milliseconds) that an app hosting an always-on VPN is placed on -    // the device idle whitelist during service launch and VPN bootstrap. -    private static final long VPN_LAUNCH_IDLE_WHITELIST_DURATION_MS = 60 * 1000; +    // the device idle allowlist during service launch and VPN bootstrap. +    private static final long VPN_LAUNCH_IDLE_ALLOWLIST_DURATION_MS = 60 * 1000;      // Settings for how much of the address space should be routed so that Vpn considers      // "most" of the address space is routed. This is used to determine whether this Vpn @@ -180,7 +180,8 @@ public class Vpn {      // This is taken as a total of IPv4 + IPV6 routes for simplicity, but the algorithm      // is actually O(n²)+O(n²).      private static final int MAX_ROUTES_TO_EVALUATE = 150; - +    private static final String LOCKDOWN_ALLOWLIST_SETTING_NAME = +            Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN_WHITELIST;      /**       * Largest profile size allowable for Platform VPNs.       * @@ -236,7 +237,7 @@ public class Vpn {       * Set of packages in addition to the VPN app itself that can access the network directly when       * VPN is not connected even if {@code mLockdown} is set.       */ -    private @NonNull List<String> mLockdownWhitelist = Collections.emptyList(); +    private @NonNull List<String> mLockdownAllowlist = Collections.emptyList();       /**       * A memory of what UIDs this class told netd to block for the lockdown feature. @@ -520,7 +521,7 @@ public class Vpn {              }          }          if (!hadUnderlyingNetworks) { -            // No idea what the underlying networks are; assume sane defaults +            // No idea what the underlying networks are; assume the safer defaults              metered = true;              roaming = false;              congested = false; @@ -653,18 +654,18 @@ public class Vpn {       *       * @param packageName the package to designate as always-on VPN supplier.       * @param lockdown whether to prevent traffic outside of a VPN, for example while connecting. -     * @param lockdownWhitelist packages to be whitelisted from lockdown. +     * @param lockdownAllowlist packages to be allowed from lockdown.       * @param keyStore the Keystore instance to use for checking of PlatformVpnProfile(s)       * @return {@code true} if the package has been set as always-on, {@code false} otherwise.       */      public synchronized boolean setAlwaysOnPackage(              @Nullable String packageName,              boolean lockdown, -            @Nullable List<String> lockdownWhitelist, +            @Nullable List<String> lockdownAllowlist,              @NonNull KeyStore keyStore) {          enforceControlPermissionOrInternalCaller(); -        if (setAlwaysOnPackageInternal(packageName, lockdown, lockdownWhitelist, keyStore)) { +        if (setAlwaysOnPackageInternal(packageName, lockdown, lockdownAllowlist, keyStore)) {              saveAlwaysOnPackage();              return true;          } @@ -679,7 +680,7 @@ public class Vpn {       *       * @param packageName the package to designate as always-on VPN supplier.       * @param lockdown whether to prevent traffic outside of a VPN, for example while connecting. -     * @param lockdownWhitelist packages to be whitelisted from lockdown. This is only used if +     * @param lockdownAllowlist packages to be allowed to bypass lockdown. This is only used if       *     {@code lockdown} is {@code true}. Packages must not contain commas.       * @param keyStore the system keystore instance to check for profiles       * @return {@code true} if the package has been set as always-on, {@code false} otherwise. @@ -687,16 +688,16 @@ public class Vpn {      @GuardedBy("this")      private boolean setAlwaysOnPackageInternal(              @Nullable String packageName, boolean lockdown, -            @Nullable List<String> lockdownWhitelist, @NonNull KeyStore keyStore) { +            @Nullable List<String> lockdownAllowlist, @NonNull KeyStore keyStore) {          if (VpnConfig.LEGACY_VPN.equals(packageName)) {              Log.w(TAG, "Not setting legacy VPN \"" + packageName + "\" as always-on.");              return false;          } -        if (lockdownWhitelist != null) { -            for (String pkg : lockdownWhitelist) { +        if (lockdownAllowlist != null) { +            for (String pkg : lockdownAllowlist) {                  if (pkg.contains(",")) { -                    Log.w(TAG, "Not setting always-on vpn, invalid whitelisted package: " + pkg); +                    Log.w(TAG, "Not setting always-on vpn, invalid allowed package: " + pkg);                      return false;                  }              } @@ -724,8 +725,8 @@ public class Vpn {          }          mLockdown = (mAlwaysOn && lockdown); -        mLockdownWhitelist = (mLockdown && lockdownWhitelist != null) -                ? Collections.unmodifiableList(new ArrayList<>(lockdownWhitelist)) +        mLockdownAllowlist = (mLockdown && lockdownAllowlist != null) +                ? Collections.unmodifiableList(new ArrayList<>(lockdownAllowlist))                  : Collections.emptyList();          if (isCurrentPreparedPackage(packageName)) { @@ -754,10 +755,10 @@ public class Vpn {      }      /** -     * @return an immutable list of packages whitelisted from always-on VPN lockdown. +     * @return an immutable list of packages allowed to bypass always-on VPN lockdown.       */ -    public synchronized List<String> getLockdownWhitelist() { -        return mLockdown ? mLockdownWhitelist : null; +    public synchronized List<String> getLockdownAllowlist() { +        return mLockdown ? mLockdownAllowlist : null;      }      /** @@ -772,8 +773,8 @@ public class Vpn {              mSystemServices.settingsSecurePutIntForUser(Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN,                      (mAlwaysOn && mLockdown ? 1 : 0), mUserHandle);              mSystemServices.settingsSecurePutStringForUser( -                    Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN_WHITELIST, -                    String.join(",", mLockdownWhitelist), mUserHandle); +                    LOCKDOWN_ALLOWLIST_SETTING_NAME, +                    String.join(",", mLockdownAllowlist), mUserHandle);          } finally {              Binder.restoreCallingIdentity(token);          } @@ -788,12 +789,12 @@ public class Vpn {                      Settings.Secure.ALWAYS_ON_VPN_APP, mUserHandle);              final boolean alwaysOnLockdown = mSystemServices.settingsSecureGetIntForUser(                      Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN, 0 /*default*/, mUserHandle) != 0; -            final String whitelistString = mSystemServices.settingsSecureGetStringForUser( -                    Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN_WHITELIST, mUserHandle); -            final List<String> whitelistedPackages = TextUtils.isEmpty(whitelistString) -                    ? Collections.emptyList() : Arrays.asList(whitelistString.split(",")); +            final String allowlistString = mSystemServices.settingsSecureGetStringForUser( +                    LOCKDOWN_ALLOWLIST_SETTING_NAME, mUserHandle); +            final List<String> allowedPackages = TextUtils.isEmpty(allowlistString) +                    ? Collections.emptyList() : Arrays.asList(allowlistString.split(","));              setAlwaysOnPackageInternal( -                    alwaysOnPackage, alwaysOnLockdown, whitelistedPackages, keyStore); +                    alwaysOnPackage, alwaysOnLockdown, allowedPackages, keyStore);          } finally {              Binder.restoreCallingIdentity(token);          } @@ -849,7 +850,7 @@ public class Vpn {              DeviceIdleController.LocalService idleController =                      LocalServices.getService(DeviceIdleController.LocalService.class);              idleController.addPowerSaveTempWhitelistApp(Process.myUid(), alwaysOnPackage, -                    VPN_LAUNCH_IDLE_WHITELIST_DURATION_MS, mUserHandle, false, "vpn"); +                    VPN_LAUNCH_IDLE_ALLOWLIST_DURATION_MS, mUserHandle, false, "vpn");              // Start the VPN service declared in the app's manifest.              Intent serviceIntent = new Intent(VpnConfig.SERVICE_INTERFACE); @@ -1212,7 +1213,7 @@ public class Vpn {          // applications have changed. Consider diffing UID ranges and only applying the delta.          if (!Objects.equals(oldConfig.allowedApplications, mConfig.allowedApplications) ||                  !Objects.equals(oldConfig.disallowedApplications, mConfig.disallowedApplications)) { -            Log.i(TAG, "Handover not possible due to changes to whitelisted/blacklisted apps"); +            Log.i(TAG, "Handover not possible due to changes to allowed/denied apps");              return false;          } @@ -1440,13 +1441,13 @@ public class Vpn {       * associated with one user, and any restricted profiles attached to that user.       *       * <p>If one of {@param allowedApplications} or {@param disallowedApplications} is provided, -     * the UID ranges will match the app whitelist or blacklist specified there. Otherwise, all UIDs +     * the UID ranges will match the app list specified there. Otherwise, all UIDs       * in each user and profile will be included.       *       * @param userHandle The userId to create UID ranges for along with any of its restricted       *                   profiles. -     * @param allowedApplications (optional) whitelist of applications to include. -     * @param disallowedApplications (optional) blacklist of applications to exclude. +     * @param allowedApplications (optional) List of applications to allow. +     * @param disallowedApplications (optional) List of applications to deny.       */      @VisibleForTesting      Set<UidRange> createUserAndRestrictedProfilesRanges(@UserIdInt int userHandle, @@ -1480,13 +1481,13 @@ public class Vpn {       * associated with one user.       *       * <p>If one of {@param allowedApplications} or {@param disallowedApplications} is provided, -     * the UID ranges will match the app whitelist or blacklist specified there. Otherwise, all UIDs +     * the UID ranges will match the app allowlist or denylist specified there. Otherwise, all UIDs       * in the user will be included.       *       * @param ranges {@link Set} of {@link UidRange}s to which to add.       * @param userHandle The userId to add to {@param ranges}. -     * @param allowedApplications (optional) whitelist of applications to include. -     * @param disallowedApplications (optional) blacklist of applications to exclude. +     * @param allowedApplications (optional) allowlist of applications to include. +     * @param disallowedApplications (optional) denylist of applications to exclude.       */      @VisibleForTesting      void addUserToRanges(@NonNull Set<UidRange> ranges, @UserIdInt int userHandle, @@ -1608,7 +1609,7 @@ public class Vpn {      /**       * Restricts network access from all UIDs affected by this {@link Vpn}, apart from the VPN -     * service app itself and whitelisted packages, to only sockets that have had {@code protect()} +     * service app itself and allowed packages, to only sockets that have had {@code protect()}       * called on them. All non-VPN traffic is blocked via a {@code PROHIBIT} response from the       * kernel.       * @@ -1630,7 +1631,7 @@ public class Vpn {          if (isNullOrLegacyVpn(mPackage)) {              exemptedPackages = null;          } else { -            exemptedPackages = new ArrayList<>(mLockdownWhitelist); +            exemptedPackages = new ArrayList<>(mLockdownAllowlist);              exemptedPackages.add(mPackage);          }          final Set<UidRange> rangesToTellNetdToRemove = new ArraySet<>(mBlockedUidsAsToldToNetd); @@ -1675,7 +1676,7 @@ public class Vpn {       * Tell netd to add or remove a list of {@link UidRange}s to the list of UIDs that are only       * allowed to make connections through sockets that have had {@code protect()} called on them.       * -     * @param enforce {@code true} to add to the blacklist, {@code false} to remove. +     * @param enforce {@code true} to add to the denylist, {@code false} to remove.       * @param ranges {@link Collection} of {@link UidRange}s to add (if {@param enforce} is       *               {@code true}) or to remove.       * @return {@code true} if all of the UIDs were added/removed. {@code false} otherwise, diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java index 944a95dda99b..75f51d82a8d6 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java @@ -81,7 +81,7 @@ public abstract class InputMethodManagerInternal {              };      /** -     * @return Global instance if exists.  Otherwise, a dummy no-op instance. +     * @return Global instance if exists.  Otherwise, a fallback no-op instance.       */      @NonNull      public static InputMethodManagerInternal get() { diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 69cbc22f41bf..70a3054d8ec3 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -1869,8 +1869,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub       * @param client {@link android.os.Binder} proxy that is associated with the singleton instance       *               of {@link android.view.inputmethod.InputMethodManager} that runs on the client       *               process -     * @param inputContext communication channel for the dummy -     *                     {@link android.view.inputmethod.InputConnection} +     * @param inputContext communication channel for the fallback {@link InputConnection}       * @param selfReportedDisplayId self-reported display ID to which the client is associated.       *                              Whether the client is still allowed to access to this display       *                              or not needs to be evaluated every time the client interacts diff --git a/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java index 3dd730471dca..956de656ab65 100644 --- a/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java @@ -1590,7 +1590,7 @@ public final class MultiClientInputMethodManagerService {                  }                  if (editorInfo == null) { -                    // So-called dummy InputConnection scenario.  For app compatibility, we still +                    // So-called fallback InputConnection scenario.  For app compatibility, we still                      // notify this to the IME.                      switch (clientInfo.mState) {                          case InputMethodClientState.READY_TO_SEND_FIRST_BIND_RESULT: diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 0e2f0ce991c7..8648e9fd2515 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -3038,7 +3038,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub                      mLockWallpaperMap.put(userId, wallpaper);                      ensureSaneWallpaperData(wallpaper, DEFAULT_DISPLAY);                  } else { -                    // sanity fallback: we're in bad shape, but establishing a known +                    // rationality fallback: we're in bad shape, but establishing a known                      // valid system+lock WallpaperData will keep us from dying.                      Slog.wtf(TAG, "Didn't find wallpaper in non-lock case!");                      wallpaper = new WallpaperData(userId, WALLPAPER, WALLPAPER_CROP); diff --git a/services/tests/servicestests/src/com/android/server/inputmethod/InputMethodUtilsTest.java b/services/tests/servicestests/src/com/android/server/inputmethod/InputMethodUtilsTest.java index e4c9cc3c05d9..1d914ec083fa 100644 --- a/services/tests/servicestests/src/com/android/server/inputmethod/InputMethodUtilsTest.java +++ b/services/tests/servicestests/src/com/android/server/inputmethod/InputMethodUtilsTest.java @@ -88,36 +88,36 @@ public class InputMethodUtilsTest {      public void testVoiceImes() throws Exception {          // locale: en_US          assertDefaultEnabledImes(getImesWithDefaultVoiceIme(), LOCALE_EN_US, -                "DummyDefaultEnKeyboardIme", "DummyDefaultAutoVoiceIme"); +                "FakeDefaultEnKeyboardIme", "FakeDefaultAutoVoiceIme");          assertDefaultEnabledImes(getImesWithoutDefaultVoiceIme(), LOCALE_EN_US, -                "DummyDefaultEnKeyboardIme", "DummyNonDefaultAutoVoiceIme0", -                "DummyNonDefaultAutoVoiceIme1"); +                "FakeDefaultEnKeyboardIme", "FakeNonDefaultAutoVoiceIme0", +                "FakeNonDefaultAutoVoiceIme1");          assertDefaultEnabledMinimumImes(getImesWithDefaultVoiceIme(), LOCALE_EN_US, -                "DummyDefaultEnKeyboardIme"); +                "FakeDefaultEnKeyboardIme");          assertDefaultEnabledMinimumImes(getImesWithoutDefaultVoiceIme(), LOCALE_EN_US, -                "DummyDefaultEnKeyboardIme"); +                "FakeDefaultEnKeyboardIme");          // locale: en_GB          assertDefaultEnabledImes(getImesWithDefaultVoiceIme(), LOCALE_EN_GB, -                "DummyDefaultEnKeyboardIme", "DummyDefaultAutoVoiceIme"); +                "FakeDefaultEnKeyboardIme", "FakeDefaultAutoVoiceIme");          assertDefaultEnabledImes(getImesWithoutDefaultVoiceIme(), LOCALE_EN_GB, -                "DummyDefaultEnKeyboardIme", "DummyNonDefaultAutoVoiceIme0", -                "DummyNonDefaultAutoVoiceIme1"); +                "FakeDefaultEnKeyboardIme", "FakeNonDefaultAutoVoiceIme0", +                "FakeNonDefaultAutoVoiceIme1");          assertDefaultEnabledMinimumImes(getImesWithDefaultVoiceIme(), LOCALE_EN_GB, -                "DummyDefaultEnKeyboardIme"); +                "FakeDefaultEnKeyboardIme");          assertDefaultEnabledMinimumImes(getImesWithoutDefaultVoiceIme(), LOCALE_EN_GB, -                "DummyDefaultEnKeyboardIme"); +                "FakeDefaultEnKeyboardIme");          // locale: ja_JP          assertDefaultEnabledImes(getImesWithDefaultVoiceIme(), LOCALE_JA_JP, -                "DummyDefaultEnKeyboardIme", "DummyDefaultAutoVoiceIme"); +                "FakeDefaultEnKeyboardIme", "FakeDefaultAutoVoiceIme");          assertDefaultEnabledImes(getImesWithoutDefaultVoiceIme(), LOCALE_JA_JP, -                "DummyDefaultEnKeyboardIme", "DummyNonDefaultAutoVoiceIme0", -                "DummyNonDefaultAutoVoiceIme1"); +                "FakeDefaultEnKeyboardIme", "FakeNonDefaultAutoVoiceIme0", +                "FakeNonDefaultAutoVoiceIme1");          assertDefaultEnabledMinimumImes(getImesWithDefaultVoiceIme(), LOCALE_JA_JP, -                "DummyDefaultEnKeyboardIme"); +                "FakeDefaultEnKeyboardIme");          assertDefaultEnabledMinimumImes(getImesWithoutDefaultVoiceIme(), LOCALE_JA_JP, -                "DummyDefaultEnKeyboardIme"); +                "FakeDefaultEnKeyboardIme");      }      @Test @@ -189,67 +189,67 @@ public class InputMethodUtilsTest {      @Test      public void testGetImplicitlyApplicableSubtypesLocked() throws Exception { -        final InputMethodSubtype nonAutoEnUS = createDummyInputMethodSubtype("en_US", +        final InputMethodSubtype nonAutoEnUS = createFakeInputMethodSubtype("en_US",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoEnGB = createDummyInputMethodSubtype("en_GB", +        final InputMethodSubtype nonAutoEnGB = createFakeInputMethodSubtype("en_GB",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoEnIN = createDummyInputMethodSubtype("en_IN", +        final InputMethodSubtype nonAutoEnIN = createFakeInputMethodSubtype("en_IN",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoFrCA = createDummyInputMethodSubtype("fr_CA", +        final InputMethodSubtype nonAutoFrCA = createFakeInputMethodSubtype("fr_CA",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoFr = createDummyInputMethodSubtype("fr_CA", +        final InputMethodSubtype nonAutoFr = createFakeInputMethodSubtype("fr_CA",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoFil = createDummyInputMethodSubtype("fil", +        final InputMethodSubtype nonAutoFil = createFakeInputMethodSubtype("fil",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoIn = createDummyInputMethodSubtype("in", +        final InputMethodSubtype nonAutoIn = createFakeInputMethodSubtype("in",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoId = createDummyInputMethodSubtype("id", +        final InputMethodSubtype nonAutoId = createFakeInputMethodSubtype("id",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype autoSubtype = createDummyInputMethodSubtype("auto", +        final InputMethodSubtype autoSubtype = createFakeInputMethodSubtype("auto",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoJa = createDummyInputMethodSubtype("ja", +        final InputMethodSubtype nonAutoJa = createFakeInputMethodSubtype("ja",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  !IS_ASCII_CAPABLE, !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoHi = createDummyInputMethodSubtype("hi", +        final InputMethodSubtype nonAutoHi = createFakeInputMethodSubtype("hi",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  !IS_ASCII_CAPABLE, !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoSrCyrl = createDummyInputMethodSubtype("sr", +        final InputMethodSubtype nonAutoSrCyrl = createFakeInputMethodSubtype("sr",                  "sr-Cyrl", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                  !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                  !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoSrLatn = createDummyInputMethodSubtype("sr_ZZ", +        final InputMethodSubtype nonAutoSrLatn = createFakeInputMethodSubtype("sr_ZZ",                  "sr-Latn", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                  !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, IS_ASCII_CAPABLE,                  !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoHandwritingEn = createDummyInputMethodSubtype("en", +        final InputMethodSubtype nonAutoHandwritingEn = createFakeInputMethodSubtype("en",                  SUBTYPE_MODE_HANDWRITING, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  !IS_ASCII_CAPABLE, !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoHandwritingFr = createDummyInputMethodSubtype("fr", +        final InputMethodSubtype nonAutoHandwritingFr = createFakeInputMethodSubtype("fr",                  SUBTYPE_MODE_HANDWRITING, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  !IS_ASCII_CAPABLE, !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoHandwritingSrCyrl = createDummyInputMethodSubtype("sr", +        final InputMethodSubtype nonAutoHandwritingSrCyrl = createFakeInputMethodSubtype("sr",                  "sr-Cyrl", SUBTYPE_MODE_HANDWRITING, !IS_AUX,                  !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                  !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoHandwritingSrLatn = createDummyInputMethodSubtype("sr_ZZ", +        final InputMethodSubtype nonAutoHandwritingSrLatn = createFakeInputMethodSubtype("sr_ZZ",                  "sr-Latn", SUBTYPE_MODE_HANDWRITING, !IS_AUX,                  !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                  !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE);          final InputMethodSubtype nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype = -                createDummyInputMethodSubtype("zz", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +                createFakeInputMethodSubtype("zz", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                          !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                          IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE);          final InputMethodSubtype nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype2 = -                createDummyInputMethodSubtype("zz", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +                createFakeInputMethodSubtype("zz", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                          !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                          IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); @@ -266,9 +266,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype2);              subtypes.add(nonAutoHandwritingEn);              subtypes.add(nonAutoHandwritingFr); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -290,9 +290,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype2);              subtypes.add(nonAutoHandwritingEn);              subtypes.add(nonAutoHandwritingFr); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -314,9 +314,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype);              subtypes.add(nonAutoHandwritingEn);              subtypes.add(nonAutoHandwritingFr); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -339,9 +339,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype2);              subtypes.add(nonAutoHandwritingEn);              subtypes.add(nonAutoHandwritingFr); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -360,9 +360,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype2);              subtypes.add(nonAutoHandwritingEn);              subtypes.add(nonAutoHandwritingFr); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -382,9 +382,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype2);              subtypes.add(nonAutoHandwritingEn);              subtypes.add(nonAutoHandwritingFr); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -404,9 +404,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoHandwritingEn);              subtypes.add(nonAutoHandwritingFr);              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -421,9 +421,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoHandwritingEn);              subtypes.add(nonAutoHandwritingFr);              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -438,9 +438,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoEnUS);              subtypes.add(nonAutoHi);              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -460,9 +460,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoHandwritingFr);              subtypes.add(nonAutoHandwritingSrCyrl);              subtypes.add(nonAutoHandwritingSrLatn); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -480,9 +480,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoHandwritingFr);              subtypes.add(nonAutoHandwritingSrCyrl);              subtypes.add(nonAutoHandwritingSrLatn); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -506,9 +506,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoHandwritingFr);              subtypes.add(nonAutoHandwritingSrCyrl);              subtypes.add(nonAutoHandwritingSrLatn); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -533,9 +533,9 @@ public class InputMethodUtilsTest {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              subtypes.add(nonAutoEnUS);              subtypes.add(nonAutoFil); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -551,9 +551,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoJa);              subtypes.add(nonAutoEnUS);              subtypes.add(nonAutoFil); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -567,9 +567,9 @@ public class InputMethodUtilsTest {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              subtypes.add(nonAutoIn);              subtypes.add(nonAutoEnUS); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -581,9 +581,9 @@ public class InputMethodUtilsTest {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              subtypes.add(nonAutoIn);              subtypes.add(nonAutoEnUS); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -595,9 +595,9 @@ public class InputMethodUtilsTest {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              subtypes.add(nonAutoId);              subtypes.add(nonAutoEnUS); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -609,9 +609,9 @@ public class InputMethodUtilsTest {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              subtypes.add(nonAutoId);              subtypes.add(nonAutoEnUS); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -631,9 +631,9 @@ public class InputMethodUtilsTest {              subtypes.add(nonAutoFil);              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype);              subtypes.add(nonAutoEnabledWhenDefaultIsNotAsciiCalableSubtype2); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              final ArrayList<InputMethodSubtype> result =                      InputMethodUtils.getImplicitlyApplicableSubtypesLocked( @@ -649,22 +649,22 @@ public class InputMethodUtilsTest {      @Test      public void testContainsSubtypeOf() throws Exception { -        final InputMethodSubtype nonAutoEnUS = createDummyInputMethodSubtype("en_US", +        final InputMethodSubtype nonAutoEnUS = createFakeInputMethodSubtype("en_US",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoEnGB = createDummyInputMethodSubtype("en_GB", +        final InputMethodSubtype nonAutoEnGB = createFakeInputMethodSubtype("en_GB",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoFil = createDummyInputMethodSubtype("fil", +        final InputMethodSubtype nonAutoFil = createFakeInputMethodSubtype("fil",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoFilPH = createDummyInputMethodSubtype("fil_PH", +        final InputMethodSubtype nonAutoFilPH = createFakeInputMethodSubtype("fil_PH",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoIn = createDummyInputMethodSubtype("in", +        final InputMethodSubtype nonAutoIn = createFakeInputMethodSubtype("in",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); -        final InputMethodSubtype nonAutoId = createDummyInputMethodSubtype("id", +        final InputMethodSubtype nonAutoId = createFakeInputMethodSubtype("id",                  SUBTYPE_MODE_KEYBOARD, !IS_AUX, !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE,                  IS_ASCII_CAPABLE, IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); @@ -673,9 +673,9 @@ public class InputMethodUtilsTest {          {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              subtypes.add(nonAutoEnUS); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              assertTrue(InputMethodUtils.containsSubtypeOf(imi, LOCALE_EN, !CHECK_COUNTRY, @@ -705,9 +705,9 @@ public class InputMethodUtilsTest {          {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              subtypes.add(nonAutoFil); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              assertTrue(InputMethodUtils.containsSubtypeOf(imi, LOCALE_FIL, !CHECK_COUNTRY,                      SUBTYPE_MODE_KEYBOARD)); @@ -732,9 +732,9 @@ public class InputMethodUtilsTest {          {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              subtypes.add(nonAutoFilPH); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              assertTrue(InputMethodUtils.containsSubtypeOf(imi, LOCALE_FIL, !CHECK_COUNTRY,                      SUBTYPE_MODE_KEYBOARD)); @@ -760,9 +760,9 @@ public class InputMethodUtilsTest {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              subtypes.add(nonAutoIn);              subtypes.add(nonAutoEnUS); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              assertTrue(InputMethodUtils.containsSubtypeOf(imi, LOCALE_IN, !CHECK_COUNTRY,                      SUBTYPE_MODE_KEYBOARD)); @@ -779,9 +779,9 @@ public class InputMethodUtilsTest {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              subtypes.add(nonAutoId);              subtypes.add(nonAutoEnUS); -            final InputMethodInfo imi = createDummyInputMethodInfo( +            final InputMethodInfo imi = createFakeInputMethodInfo(                      "com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, IS_DEFAULT, +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, IS_DEFAULT,                      subtypes);              assertTrue(InputMethodUtils.containsSubtypeOf(imi, LOCALE_IN, !CHECK_COUNTRY,                      SUBTYPE_MODE_KEYBOARD)); @@ -866,7 +866,7 @@ public class InputMethodUtilsTest {          assertEquals(expected.hashCode(), actual.hashCode());      } -    private static InputMethodInfo createDummyInputMethodInfo(String packageName, String name, +    private static InputMethodInfo createFakeInputMethodInfo(String packageName, String name,              CharSequence label, boolean isAuxIme, boolean isDefault,              List<InputMethodSubtype> subtypes) {          final ResolveInfo ri = new ResolveInfo(); @@ -885,15 +885,15 @@ public class InputMethodUtilsTest {          return new InputMethodInfo(ri, isAuxIme, "", subtypes, 1, isDefault);      } -    private static InputMethodSubtype createDummyInputMethodSubtype(String locale, String mode, +    private static InputMethodSubtype createFakeInputMethodSubtype(String locale, String mode,              boolean isAuxiliary, boolean overridesImplicitlyEnabledSubtype,              boolean isAsciiCapable, boolean isEnabledWhenDefaultIsNotAsciiCapable) { -        return createDummyInputMethodSubtype(locale, null /* languageTag */, mode, isAuxiliary, +        return createFakeInputMethodSubtype(locale, null /* languageTag */, mode, isAuxiliary,                  overridesImplicitlyEnabledSubtype, isAsciiCapable,                  isEnabledWhenDefaultIsNotAsciiCapable);      } -    private static InputMethodSubtype createDummyInputMethodSubtype(String locale, +    private static InputMethodSubtype createFakeInputMethodSubtype(String locale,              String languageTag, String mode, boolean isAuxiliary,              boolean overridesImplicitlyEnabledSubtype, boolean isAsciiCapable,              boolean isEnabledWhenDefaultIsNotAsciiCapable) { @@ -920,14 +920,14 @@ public class InputMethodUtilsTest {          ArrayList<InputMethodInfo> preinstalledImes = new ArrayList<>();          {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>(); -            subtypes.add(createDummyInputMethodSubtype("auto", SUBTYPE_MODE_VOICE, IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("auto", SUBTYPE_MODE_VOICE, IS_AUX,                      IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            subtypes.add(createDummyInputMethodSubtype("en_US", SUBTYPE_MODE_VOICE, IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("en_US", SUBTYPE_MODE_VOICE, IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("DummyDefaultAutoVoiceIme", -                    "dummy.voice0", "DummyVoice0", IS_AUX, IS_DEFAULT, subtypes)); +            preinstalledImes.add(createFakeInputMethodInfo("FakeDefaultAutoVoiceIme", +                    "fake.voice0", "FakeVoice0", IS_AUX, IS_DEFAULT, subtypes));          }          preinstalledImes.addAll(getImesWithoutDefaultVoiceIme());          return preinstalledImes; @@ -937,41 +937,41 @@ public class InputMethodUtilsTest {          ArrayList<InputMethodInfo> preinstalledImes = new ArrayList<>();          {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>(); -            subtypes.add(createDummyInputMethodSubtype("auto", SUBTYPE_MODE_VOICE, IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("auto", SUBTYPE_MODE_VOICE, IS_AUX,                      IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            subtypes.add(createDummyInputMethodSubtype("en_US", SUBTYPE_MODE_VOICE, IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("en_US", SUBTYPE_MODE_VOICE, IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("DummyNonDefaultAutoVoiceIme0", -                    "dummy.voice1", "DummyVoice1", IS_AUX, !IS_DEFAULT, subtypes)); +            preinstalledImes.add(createFakeInputMethodInfo("FakeNonDefaultAutoVoiceIme0", +                    "fake.voice1", "FakeVoice1", IS_AUX, !IS_DEFAULT, subtypes));          }          {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>(); -            subtypes.add(createDummyInputMethodSubtype("auto", SUBTYPE_MODE_VOICE, IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("auto", SUBTYPE_MODE_VOICE, IS_AUX,                      IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            subtypes.add(createDummyInputMethodSubtype("en_US", SUBTYPE_MODE_VOICE, IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("en_US", SUBTYPE_MODE_VOICE, IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("DummyNonDefaultAutoVoiceIme1", -                    "dummy.voice2", "DummyVoice2", IS_AUX, !IS_DEFAULT, subtypes)); +            preinstalledImes.add(createFakeInputMethodInfo("FakeNonDefaultAutoVoiceIme1", +                    "fake.voice2", "FakeVoice2", IS_AUX, !IS_DEFAULT, subtypes));          }          {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>(); -            subtypes.add(createDummyInputMethodSubtype("en_US", SUBTYPE_MODE_VOICE, IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("en_US", SUBTYPE_MODE_VOICE, IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("DummyNonDefaultVoiceIme2", -                    "dummy.voice3", "DummyVoice3", IS_AUX, !IS_DEFAULT, subtypes)); +            preinstalledImes.add(createFakeInputMethodInfo("FakeNonDefaultVoiceIme2", +                    "fake.voice3", "FakeVoice3", IS_AUX, !IS_DEFAULT, subtypes));          }          {              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>(); -            subtypes.add(createDummyInputMethodSubtype("en_US", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("en_US", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("DummyDefaultEnKeyboardIme", -                    "dummy.keyboard0", "DummyKeyboard0", !IS_AUX, IS_DEFAULT, subtypes)); +            preinstalledImes.add(createFakeInputMethodInfo("FakeDefaultEnKeyboardIme", +                    "fake.keyboard0", "FakeKeyboard0", !IS_AUX, IS_DEFAULT, subtypes));          }          return preinstalledImes;      } @@ -991,91 +991,91 @@ public class InputMethodUtilsTest {      private static ArrayList<InputMethodInfo> getSamplePreinstalledImes(final String localeString) {          ArrayList<InputMethodInfo> preinstalledImes = new ArrayList<>(); -        // a dummy Voice IME +        // a fake Voice IME          {              final boolean isDefaultIme = false;              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>(); -            subtypes.add(createDummyInputMethodSubtype("", SUBTYPE_MODE_VOICE, IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("", SUBTYPE_MODE_VOICE, IS_AUX,                      IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("com.android.apps.inputmethod.voice", -                    "com.android.inputmethod.voice", "DummyVoiceIme", IS_AUX, isDefaultIme, +            preinstalledImes.add(createFakeInputMethodInfo("com.android.apps.inputmethod.voice", +                    "com.android.inputmethod.voice", "FakeVoiceIme", IS_AUX, isDefaultIme,                      subtypes));          } -        // a dummy Hindi IME +        // a fake Hindi IME          {              final boolean isDefaultIme = contains(new String[]{ "hi", "en-rIN" }, localeString);              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();              // TODO: This subtype should be marked as IS_ASCII_CAPABLE -            subtypes.add(createDummyInputMethodSubtype("en_IN", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("en_IN", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            subtypes.add(createDummyInputMethodSubtype("hi", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("hi", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("com.android.apps.inputmethod.hindi", -                    "com.android.inputmethod.hindi", "DummyHindiIme", !IS_AUX, isDefaultIme, +            preinstalledImes.add(createFakeInputMethodInfo("com.android.apps.inputmethod.hindi", +                    "com.android.inputmethod.hindi", "FakeHindiIme", !IS_AUX, isDefaultIme,                      subtypes));          } -        // a dummy Pinyin IME +        // a fake Pinyin IME          {              final boolean isDefaultIme = contains(new String[]{ "zh-rCN" }, localeString);              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>(); -            subtypes.add(createDummyInputMethodSubtype("zh_CN", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("zh_CN", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("com.android.apps.inputmethod.pinyin", -                    "com.android.apps.inputmethod.pinyin", "DummyPinyinIme", !IS_AUX, isDefaultIme, +            preinstalledImes.add(createFakeInputMethodInfo("com.android.apps.inputmethod.pinyin", +                    "com.android.apps.inputmethod.pinyin", "FakePinyinIme", !IS_AUX, isDefaultIme,                      subtypes));          } -        // a dummy Korean IME +        // a fake Korean IME          {              final boolean isDefaultIme = contains(new String[]{ "ko" }, localeString);              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>(); -            subtypes.add(createDummyInputMethodSubtype("ko", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("ko", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("com.android.apps.inputmethod.korean", -                    "com.android.apps.inputmethod.korean", "DummyKoreanIme", !IS_AUX, isDefaultIme, +            preinstalledImes.add(createFakeInputMethodInfo("com.android.apps.inputmethod.korean", +                    "com.android.apps.inputmethod.korean", "FakeKoreanIme", !IS_AUX, isDefaultIme,                      subtypes));          } -        // a dummy Latin IME +        // a fake Latin IME          {              final boolean isDefaultIme = contains(                      new String[]{ "en-rUS", "en-rGB", "en-rIN", "en", "hi" }, localeString);              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>(); -            subtypes.add(createDummyInputMethodSubtype("en_US", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("en_US", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            subtypes.add(createDummyInputMethodSubtype("en_GB", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("en_GB", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            subtypes.add(createDummyInputMethodSubtype("en_IN", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("en_IN", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            subtypes.add(createDummyInputMethodSubtype("hi", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("hi", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("com.android.apps.inputmethod.latin", -                    "com.android.apps.inputmethod.latin", "DummyLatinIme", !IS_AUX, isDefaultIme, +            preinstalledImes.add(createFakeInputMethodInfo("com.android.apps.inputmethod.latin", +                    "com.android.apps.inputmethod.latin", "FakeLatinIme", !IS_AUX, isDefaultIme,                      subtypes));          } -        // a dummy Japanese IME +        // a fake Japanese IME          {              final boolean isDefaultIme = contains(new String[]{ "ja", "ja-rJP" }, localeString);              final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>(); -            subtypes.add(createDummyInputMethodSubtype("ja", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("ja", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            subtypes.add(createDummyInputMethodSubtype("emoji", SUBTYPE_MODE_KEYBOARD, !IS_AUX, +            subtypes.add(createFakeInputMethodSubtype("emoji", SUBTYPE_MODE_KEYBOARD, !IS_AUX,                      !IS_OVERRIDES_IMPLICITLY_ENABLED_SUBTYPE, !IS_ASCII_CAPABLE,                      !IS_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE)); -            preinstalledImes.add(createDummyInputMethodInfo("com.android.apps.inputmethod.japanese", -                    "com.android.apps.inputmethod.japanese", "DummyJapaneseIme", !IS_AUX, +            preinstalledImes.add(createFakeInputMethodInfo("com.android.apps.inputmethod.japanese", +                    "com.android.apps.inputmethod.japanese", "FakeJapaneseIme", !IS_AUX,                      isDefaultIme, subtypes));          } diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 90beae8326ef..00b711643fe6 100755 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -735,6 +735,31 @@ public abstract class Connection extends Conferenceable {              "android.telecom.extra.ORIGINAL_CONNECTION_ID";      /** +     * Extra key set on a {@link Connection} when it was created via a remote connection service. +     * For example, if a connection manager requests a remote connection service to create a call +     * using one of the remote connection service's phone account handle, this extra will be set so +     * that Telecom knows that the wrapped remote connection originated in a remote connection +     * service.  We stash this in the extras since connection managers will typically copy the +     * extras from a {@link RemoteConnection} to a {@link Connection} (there is ultimately not +     * other way to relate a {@link RemoteConnection} to a {@link Connection}. +     * @hide +     */ +    public static final String EXTRA_REMOTE_PHONE_ACCOUNT_HANDLE = +            "android.telecom.extra.REMOTE_PHONE_ACCOUNT_HANDLE"; + +    /** +     * Extra key set from a {@link ConnectionService} when using the remote connection APIs +     * (e.g. {@link RemoteConnectionService#createRemoteConnection(PhoneAccountHandle, +     * ConnectionRequest, boolean)}) to create a remote connection.  Provides the receiving +     * {@link ConnectionService} with a means to know the package name of the requesting +     * {@link ConnectionService} so that {@link #EXTRA_REMOTE_PHONE_ACCOUNT_HANDLE} can be set for +     * better visibility in Telecom of where a connection ultimately originated. +     * @hide +     */ +    public static final String EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME = +            "android.telecom.extra.REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME"; + +    /**       * Boolean connection extra key set on the extras passed to       * {@link Connection#sendConnectionEvent} which indicates that audio is present       * on the RTT call when the extra value is true. diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 8bc80adf80a8..67bdba68b778 100755 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -1859,9 +1859,25 @@ public abstract class ConnectionService extends Service {                      new DisconnectCause(DisconnectCause.ERROR, "IMPL_RETURNED_NULL_CONFERENCE"),                      request.getAccountHandle());          } -        if (conference.getExtras() != null) { -            conference.getExtras().putString(Connection.EXTRA_ORIGINAL_CONNECTION_ID, callId); + +        Bundle extras = request.getExtras(); +        Bundle newExtras = new Bundle(); +        newExtras.putString(Connection.EXTRA_ORIGINAL_CONNECTION_ID, callId); +        if (extras != null) { +            // If the request originated from a remote connection service, we will add some +            // tracking information that Telecom can use to keep informed of which package +            // made the remote request, and which remote connection service was used. +            if (extras.containsKey(Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME)) { +                newExtras.putString( +                        Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME, +                        extras.getString( +                                Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME)); +                newExtras.putParcelable(Connection.EXTRA_REMOTE_PHONE_ACCOUNT_HANDLE, +                        request.getAccountHandle()); +            }          } +        conference.putExtras(newExtras); +          mConferenceById.put(callId, conference);          mIdByConference.put(conference, callId); @@ -1937,6 +1953,30 @@ public abstract class ConnectionService extends Service {              Log.i(this, "createConnection, implementation returned null connection.");              connection = Connection.createFailedConnection(                      new DisconnectCause(DisconnectCause.ERROR, "IMPL_RETURNED_NULL_CONNECTION")); +        } else { +            try { +                Bundle extras = request.getExtras(); +                if (extras != null) { +                    // If the request originated from a remote connection service, we will add some +                    // tracking information that Telecom can use to keep informed of which package +                    // made the remote request, and which remote connection service was used. +                    if (extras.containsKey( +                            Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME)) { +                        Bundle newExtras = new Bundle(); +                        newExtras.putString( +                                Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME, +                                extras.getString( +                                        Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME +                                )); +                        newExtras.putParcelable(Connection.EXTRA_REMOTE_PHONE_ACCOUNT_HANDLE, +                                request.getAccountHandle()); +                        connection.putExtras(newExtras); +                    } +                } +            } catch (UnsupportedOperationException ose) { +                // Do nothing; if the ConnectionService reported a failure it will be an instance +                // of an immutable Connection which we cannot edit, so we're out of luck. +            }          }          boolean isSelfManaged = @@ -2448,6 +2488,42 @@ public abstract class ConnectionService extends Service {      }      /** +     * Ask some other {@code ConnectionService} to create a {@code RemoteConference} given an +     * incoming request. This is used by {@code ConnectionService}s that are registered with +     * {@link PhoneAccount#CAPABILITY_ADHOC_CONFERENCE_CALLING}. +     * +     * @param connectionManagerPhoneAccount See description at +     *          {@link #onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}. +     * @param request Details about the incoming conference call. +     * @return The {@code RemoteConference} object to satisfy this call, or {@code null} to not +     *         handle the call. +     */ +    public final @Nullable RemoteConference createRemoteIncomingConference( +            @Nullable PhoneAccountHandle connectionManagerPhoneAccount, +            @Nullable ConnectionRequest request) { +        return mRemoteConnectionManager.createRemoteConference(connectionManagerPhoneAccount, +                request, true); +    } + +    /** +     * Ask some other {@code ConnectionService} to create a {@code RemoteConference} given an +     * outgoing request. This is used by {@code ConnectionService}s that are registered with +     * {@link PhoneAccount#CAPABILITY_ADHOC_CONFERENCE_CALLING}. +     * +     * @param connectionManagerPhoneAccount See description at +     *          {@link #onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}. +     * @param request Details about the outgoing conference call. +     * @return The {@code RemoteConference} object to satisfy this call, or {@code null} to not +     *         handle the call. +     */ +    public final @Nullable RemoteConference createRemoteOutgoingConference( +            @Nullable PhoneAccountHandle connectionManagerPhoneAccount, +            @Nullable ConnectionRequest request) { +        return mRemoteConnectionManager.createRemoteConference(connectionManagerPhoneAccount, +                request, false); +    } + +    /**       * Indicates to the relevant {@code RemoteConnectionService} that the specified       * {@link RemoteConnection}s should be merged into a conference call.       * <p> diff --git a/telecomm/java/android/telecom/Logging/Session.java b/telecomm/java/android/telecom/Logging/Session.java index d82e93fac76d..8d3f4e1df8bc 100644 --- a/telecomm/java/android/telecom/Logging/Session.java +++ b/telecomm/java/android/telecom/Logging/Session.java @@ -427,7 +427,7 @@ public class Session {              StringBuilder methodName = new StringBuilder();              methodName.append(getFullMethodPath(false /*truncatePath*/));              if (mOwnerInfo != null && !mOwnerInfo.isEmpty()) { -                methodName.append("(InCall package: "); +                methodName.append("(");                  methodName.append(mOwnerInfo);                  methodName.append(")");              } diff --git a/telecomm/java/android/telecom/RemoteConference.java b/telecomm/java/android/telecom/RemoteConference.java index 502b7c01b0c0..e024e6186519 100644 --- a/telecomm/java/android/telecom/RemoteConference.java +++ b/telecomm/java/android/telecom/RemoteConference.java @@ -16,14 +16,14 @@  package android.telecom; -import com.android.internal.telecom.IConnectionService; -  import android.annotation.Nullable;  import android.annotation.SystemApi;  import android.os.Bundle;  import android.os.Handler;  import android.os.RemoteException; +import com.android.internal.telecom.IConnectionService; +  import java.util.ArrayList;  import java.util.Collections;  import java.util.List; @@ -155,6 +155,14 @@ public final class RemoteConference {      }      /** @hide */ +    RemoteConference(DisconnectCause disconnectCause) { +        mId = "NULL"; +        mConnectionService = null; +        mState = Connection.STATE_DISCONNECTED; +        mDisconnectCause = disconnectCause; +    } + +    /** @hide */      String getId() {          return mId;      } @@ -583,4 +591,16 @@ public final class RemoteConference {              }          }      } + +    /** +     * Create a {@link RemoteConference} represents a failure, and which will +     * be in {@link Connection#STATE_DISCONNECTED}. +     * +     * @param disconnectCause The disconnect cause. +     * @return a failed {@link RemoteConference} +     * @hide +     */ +    public static RemoteConference failure(DisconnectCause disconnectCause) { +        return new RemoteConference(disconnectCause); +    }  } diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index 05480dc38a0d..78b4f3bfb90b 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -16,10 +16,6 @@  package android.telecom; -import com.android.internal.telecom.IConnectionService; -import com.android.internal.telecom.IVideoCallback; -import com.android.internal.telecom.IVideoProvider; -  import android.annotation.NonNull;  import android.annotation.Nullable;  import android.annotation.SystemApi; @@ -32,6 +28,10 @@ import android.os.IBinder;  import android.os.RemoteException;  import android.view.Surface; +import com.android.internal.telecom.IConnectionService; +import com.android.internal.telecom.IVideoCallback; +import com.android.internal.telecom.IVideoProvider; +  import java.util.ArrayList;  import java.util.Collections;  import java.util.List; @@ -1061,6 +1061,23 @@ public final class RemoteConnection {      }      /** +     * Instructs this {@link RemoteConnection} to initiate a conference with a list of +     * participants. +     * <p> +     * +     * @param participants with which conference call will be formed. +     */ +    public void addConferenceParticipants(@NonNull List<Uri> participants) { +        try { +            if (mConnected) { +                mConnectionService.addConferenceParticipants(mConnectionId, participants, +                        null /*Session.Info*/); +            } +        } catch (RemoteException ignored) { +        } +    } + +    /**       * Set the audio state of this {@code RemoteConnection}.       *       * @param state The audio state of this {@code RemoteConnection}. diff --git a/telecomm/java/android/telecom/RemoteConnectionManager.java b/telecomm/java/android/telecom/RemoteConnectionManager.java index 0322218d75dc..f3c7bd83ed4b 100644 --- a/telecomm/java/android/telecom/RemoteConnectionManager.java +++ b/telecomm/java/android/telecom/RemoteConnectionManager.java @@ -73,6 +73,37 @@ public class RemoteConnectionManager {          return null;      } +    /** +     * Ask a {@code RemoteConnectionService} to create a {@code RemoteConference}. +     * @param connectionManagerPhoneAccount See description at +     * {@link ConnectionService#onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}. +     * @param request Details about the incoming conference call. +     * @param isIncoming {@code true} if it's an incoming conference. +     * @return +     */ +    public RemoteConference createRemoteConference( +            PhoneAccountHandle connectionManagerPhoneAccount, +            ConnectionRequest request, +            boolean isIncoming) { +        PhoneAccountHandle accountHandle = request.getAccountHandle(); +        if (accountHandle == null) { +            throw new IllegalArgumentException("accountHandle must be specified."); +        } + +        ComponentName componentName = request.getAccountHandle().getComponentName(); +        if (!mRemoteConnectionServices.containsKey(componentName)) { +            throw new UnsupportedOperationException("accountHandle not supported: " +                    + componentName); +        } + +        RemoteConnectionService remoteService = mRemoteConnectionServices.get(componentName); +        if (remoteService != null) { +            return remoteService.createRemoteConference( +                    connectionManagerPhoneAccount, request, isIncoming); +        } +        return null; +    } +      public void conferenceRemoteConnections(RemoteConnection a, RemoteConnection b) {          if (a.getConnectionService() == b.getConnectionService()) {              try { diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java index cad5b707a146..bf6a6ef793ff 100644 --- a/telecomm/java/android/telecom/RemoteConnectionService.java +++ b/telecomm/java/android/telecom/RemoteConnectionService.java @@ -31,9 +31,9 @@ import com.android.internal.telecom.RemoteServiceCallback;  import java.util.ArrayList;  import java.util.HashMap;  import java.util.HashSet; +import java.util.List;  import java.util.Map;  import java.util.Set; -import java.util.List;  import java.util.UUID;  /** @@ -258,6 +258,9 @@ final class RemoteConnectionService {              // See comments on Connection.EXTRA_ORIGINAL_CONNECTION_ID for more information.              Bundle newExtras = new Bundle();              newExtras.putString(Connection.EXTRA_ORIGINAL_CONNECTION_ID, callId); +            // Track the fact this request was relayed through the remote connection service. +            newExtras.putParcelable(Connection.EXTRA_REMOTE_PHONE_ACCOUNT_HANDLE, +                    parcel.getPhoneAccount());              conference.putExtras(newExtras);              conference.registerCallback(new RemoteConference.Callback() { @@ -383,6 +386,11 @@ final class RemoteConnectionService {              RemoteConnection remoteConnection = new RemoteConnection(callId,                      mOutgoingConnectionServiceRpc, connection, callingPackage,                      callingTargetSdkVersion); +            // Track that it is via a remote connection. +            Bundle newExtras = new Bundle(); +            newExtras.putParcelable(Connection.EXTRA_REMOTE_PHONE_ACCOUNT_HANDLE, +                    connection.getPhoneAccount()); +            remoteConnection.putExtras(newExtras);              mConnectionById.put(callId, remoteConnection);              remoteConnection.registerCallback(new RemoteConnection.Callback() {                  @Override @@ -535,10 +543,20 @@ final class RemoteConnectionService {              ConnectionRequest request,              boolean isIncoming) {          final String id = UUID.randomUUID().toString(); +        Bundle extras = new Bundle(); +        if (request.getExtras() != null) { +            extras.putAll(request.getExtras()); +        } +        // We will set the package name for the originator of the remote request; this lets the +        // receiving ConnectionService know that the request originated from a remote connection +        // service so that it can provide tracking information for Telecom. +        extras.putString(Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME, +                mOurConnectionServiceImpl.getApplicationContext().getOpPackageName()); +          final ConnectionRequest newRequest = new ConnectionRequest.Builder()                  .setAccountHandle(request.getAccountHandle())                  .setAddress(request.getAddress()) -                .setExtras(request.getExtras()) +                .setExtras(extras)                  .setVideoState(request.getVideoState())                  .setRttPipeFromInCall(request.getRttPipeFromInCall())                  .setRttPipeToInCall(request.getRttPipeToInCall()) @@ -573,6 +591,38 @@ final class RemoteConnectionService {          }      } +    RemoteConference createRemoteConference( +            PhoneAccountHandle connectionManagerPhoneAccount, +            ConnectionRequest request, +            boolean isIncoming) { +        final String id = UUID.randomUUID().toString(); +        try { +            if (mConferenceById.isEmpty()) { +                mOutgoingConnectionServiceRpc.addConnectionServiceAdapter(mServant.getStub(), +                        null /*Session.Info*/); +            } +            RemoteConference conference = new RemoteConference(id, mOutgoingConnectionServiceRpc); +            mOutgoingConnectionServiceRpc.createConference(connectionManagerPhoneAccount, +                    id, +                    request, +                    isIncoming, +                    false /* isUnknownCall */, +                    null /*Session.info*/); +            conference.registerCallback(new RemoteConference.Callback() { +                @Override +                public void onDestroyed(RemoteConference conference) { +                    mConferenceById.remove(id); +                    maybeDisconnectAdapter(); +                } +            }); +            conference.putExtras(request.getExtras()); +            return conference; +        } catch (RemoteException e) { +            return RemoteConference.failure( +                    new DisconnectCause(DisconnectCause.ERROR, e.toString())); +        } +    } +      private boolean hasConnection(String callId) {          return mConnectionById.containsKey(callId);      } diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 15b26dcfabbe..08f31a9ea9eb 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -2202,15 +2202,23 @@ public class TelecomManager {      @NonNull      public Intent createLaunchEmergencyDialerIntent(@Nullable String number) {          ITelecomService service = getTelecomService(); -        Intent result = null;          if (service != null) {              try { -                result = service.createLaunchEmergencyDialerIntent(number); +                return service.createLaunchEmergencyDialerIntent(number);              } catch (RemoteException e) {                  Log.e(TAG, "Error createLaunchEmergencyDialerIntent", e);              } +        } else { +            Log.w(TAG, "createLaunchEmergencyDialerIntent - Telecom service not available.");          } -        return result; + +        // Telecom service knows the package name of the expected emergency dialer package; if it +        // is not available, then fallback to not targeting a specific package. +        Intent intent = new Intent(Intent.ACTION_DIAL_EMERGENCY); +        if (!TextUtils.isEmpty(number) && TextUtils.isDigitsOnly(number)) { +            intent.setData(Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null)); +        } +        return intent;      }      /** diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 3315e8da27c1..0f7344009db1 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1086,6 +1086,15 @@ public class CarrierConfigManager {          "show_signal_strength_in_sim_status_bool";      /** +     * Flag specifying if we should interpret all signal strength as one bar higher +     * This is a replacement for the former resource config_inflateSignalStrength +     * The default value is false. +     * @hide +     */ +    public static final String KEY_INFLATE_SIGNAL_STRENGTH_BOOL = +            "inflate_signal_strength_bool"; + +    /**       * Flag specifying whether an additional (client initiated) intent needs to be sent on System       * update       */ @@ -3914,6 +3923,7 @@ public class CarrierConfigManager {          sDefaults.putStringArray(KEY_CARRIER_VVM_PACKAGE_NAME_STRING_ARRAY, null);          sDefaults.putBoolean(KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL, false);          sDefaults.putBoolean(KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL, true); +        sDefaults.putBoolean(KEY_INFLATE_SIGNAL_STRENGTH_BOOL, false);          sDefaults.putBoolean(KEY_CI_ACTION_ON_SYS_UPDATE_BOOL, false);          sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING, "");          sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING, ""); diff --git a/tests/RollbackTest/README.txt b/tests/RollbackTest/README.txt index c0b718a3e2c1..bc3b3bc3a1ee 100644 --- a/tests/RollbackTest/README.txt +++ b/tests/RollbackTest/README.txt @@ -9,10 +9,10 @@ StagedRollbackTest    - device driven test for staged rollbacks.  TestApp -  - source for dummy apks used in testing. +  - source for fake apks used in testing.  TestApex -  - source for dummy apex modules used in testing. +  - source for fake apex modules used in testing.  Running the tests  ================= diff --git a/tests/net/common/java/android/net/DhcpInfoTest.java b/tests/net/common/java/android/net/DhcpInfoTest.java index 4d45ad72a9b8..ab4726bab573 100644 --- a/tests/net/common/java/android/net/DhcpInfoTest.java +++ b/tests/net/common/java/android/net/DhcpInfoTest.java @@ -17,8 +17,8 @@  package android.net;  import static com.android.net.module.util.Inet4AddressUtils.inet4AddressToIntHTL; -import static com.android.testutils.MiscAssertsKt.assertFieldCountEquals; -import static com.android.testutils.ParcelUtilsKt.parcelingRoundTrip; +import static com.android.testutils.MiscAsserts.assertFieldCountEquals; +import static com.android.testutils.ParcelUtils.parcelingRoundTrip;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse; diff --git a/tests/net/common/java/android/net/IpPrefixTest.java b/tests/net/common/java/android/net/IpPrefixTest.java index 985e10df3961..9c0fc7ce7881 100644 --- a/tests/net/common/java/android/net/IpPrefixTest.java +++ b/tests/net/common/java/android/net/IpPrefixTest.java @@ -16,10 +16,10 @@  package android.net; -import static com.android.testutils.MiscAssertsKt.assertEqualBothWays; -import static com.android.testutils.MiscAssertsKt.assertFieldCountEquals; -import static com.android.testutils.MiscAssertsKt.assertNotEqualEitherWay; -import static com.android.testutils.ParcelUtilsKt.assertParcelingIsLossless; +import static com.android.testutils.MiscAsserts.assertEqualBothWays; +import static com.android.testutils.MiscAsserts.assertFieldCountEquals; +import static com.android.testutils.MiscAsserts.assertNotEqualEitherWay; +import static com.android.testutils.ParcelUtils.assertParcelingIsLossless;  import static org.junit.Assert.assertArrayEquals;  import static org.junit.Assert.assertEquals; diff --git a/tests/net/common/java/android/net/LinkAddressTest.java b/tests/net/common/java/android/net/LinkAddressTest.java index c74c112490f8..60308e32b88d 100644 --- a/tests/net/common/java/android/net/LinkAddressTest.java +++ b/tests/net/common/java/android/net/LinkAddressTest.java @@ -27,10 +27,10 @@ import static android.system.OsConstants.RT_SCOPE_LINK;  import static android.system.OsConstants.RT_SCOPE_SITE;  import static android.system.OsConstants.RT_SCOPE_UNIVERSE; -import static com.android.testutils.MiscAssertsKt.assertEqualBothWays; -import static com.android.testutils.MiscAssertsKt.assertFieldCountEquals; -import static com.android.testutils.MiscAssertsKt.assertNotEqualEitherWay; -import static com.android.testutils.ParcelUtilsKt.assertParcelingIsLossless; +import static com.android.testutils.MiscAsserts.assertEqualBothWays; +import static com.android.testutils.MiscAsserts.assertFieldCountEquals; +import static com.android.testutils.MiscAsserts.assertNotEqualEitherWay; +import static com.android.testutils.ParcelUtils.assertParcelingIsLossless;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse; diff --git a/tests/net/common/java/android/net/LinkPropertiesTest.java b/tests/net/common/java/android/net/LinkPropertiesTest.java index 6eba62e63740..3c3076f11727 100644 --- a/tests/net/common/java/android/net/LinkPropertiesTest.java +++ b/tests/net/common/java/android/net/LinkPropertiesTest.java @@ -20,9 +20,9 @@ import static android.net.RouteInfo.RTN_THROW;  import static android.net.RouteInfo.RTN_UNICAST;  import static android.net.RouteInfo.RTN_UNREACHABLE; -import static com.android.testutils.ParcelUtilsKt.assertParcelSane; -import static com.android.testutils.ParcelUtilsKt.assertParcelingIsLossless; -import static com.android.testutils.ParcelUtilsKt.parcelingRoundTrip; +import static com.android.testutils.ParcelUtils.assertParcelSane; +import static com.android.testutils.ParcelUtils.assertParcelingIsLossless; +import static com.android.testutils.ParcelUtils.parcelingRoundTrip;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse; diff --git a/tests/net/common/java/android/net/NetworkCapabilitiesTest.java b/tests/net/common/java/android/net/NetworkCapabilitiesTest.java index 3f8261d5ad7f..e1693129892f 100644 --- a/tests/net/common/java/android/net/NetworkCapabilitiesTest.java +++ b/tests/net/common/java/android/net/NetworkCapabilitiesTest.java @@ -42,8 +42,8 @@ import static android.net.NetworkCapabilities.TRANSPORT_WIFI;  import static android.net.NetworkCapabilities.TRANSPORT_WIFI_AWARE;  import static android.net.NetworkCapabilities.UNRESTRICTED_CAPABILITIES; -import static com.android.testutils.ParcelUtilsKt.assertParcelSane; -import static com.android.testutils.ParcelUtilsKt.assertParcelingIsLossless; +import static com.android.testutils.ParcelUtils.assertParcelSane; +import static com.android.testutils.ParcelUtils.assertParcelingIsLossless;  import static org.junit.Assert.assertArrayEquals;  import static org.junit.Assert.assertEquals; diff --git a/tests/net/common/java/android/net/RouteInfoTest.java b/tests/net/common/java/android/net/RouteInfoTest.java index 60cac0b6b0f5..71689f919726 100644 --- a/tests/net/common/java/android/net/RouteInfoTest.java +++ b/tests/net/common/java/android/net/RouteInfoTest.java @@ -18,10 +18,10 @@ package android.net;  import static android.net.RouteInfo.RTN_UNREACHABLE; -import static com.android.testutils.MiscAssertsKt.assertEqualBothWays; -import static com.android.testutils.MiscAssertsKt.assertFieldCountEquals; -import static com.android.testutils.MiscAssertsKt.assertNotEqualEitherWay; -import static com.android.testutils.ParcelUtilsKt.assertParcelingIsLossless; +import static com.android.testutils.MiscAsserts.assertEqualBothWays; +import static com.android.testutils.MiscAsserts.assertFieldCountEquals; +import static com.android.testutils.MiscAsserts.assertNotEqualEitherWay; +import static com.android.testutils.ParcelUtils.assertParcelingIsLossless;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse; diff --git a/tests/net/common/java/android/net/apf/ApfCapabilitiesTest.java b/tests/net/common/java/android/net/apf/ApfCapabilitiesTest.java index 84805442e5c7..d50406fd3a1c 100644 --- a/tests/net/common/java/android/net/apf/ApfCapabilitiesTest.java +++ b/tests/net/common/java/android/net/apf/ApfCapabilitiesTest.java @@ -16,7 +16,7 @@  package android.net.apf; -import static com.android.testutils.ParcelUtilsKt.assertParcelSane; +import static com.android.testutils.ParcelUtils.assertParcelSane;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse; diff --git a/tests/net/integration/util/com/android/server/ConnectivityServiceTestUtils.kt b/tests/net/integration/util/com/android/server/ConnectivityServiceTestUtils.kt index fa2b99ce5cc6..165fd3728281 100644 --- a/tests/net/integration/util/com/android/server/ConnectivityServiceTestUtils.kt +++ b/tests/net/integration/util/com/android/server/ConnectivityServiceTestUtils.kt @@ -14,6 +14,8 @@   * limitations under the License   */ +@file:JvmName("ConnectivityServiceTestUtils") +  package com.android.server  import android.net.ConnectivityManager.TYPE_BLUETOOTH diff --git a/tests/net/integration/util/com/android/server/NetworkAgentWrapper.java b/tests/net/integration/util/com/android/server/NetworkAgentWrapper.java index 0ffafd45613a..9f0b41fa0cdf 100644 --- a/tests/net/integration/util/com/android/server/NetworkAgentWrapper.java +++ b/tests/net/integration/util/com/android/server/NetworkAgentWrapper.java @@ -24,7 +24,7 @@ import static android.net.NetworkCapabilities.TRANSPORT_VPN;  import static android.net.NetworkCapabilities.TRANSPORT_WIFI;  import static android.net.NetworkCapabilities.TRANSPORT_WIFI_AWARE; -import static com.android.server.ConnectivityServiceTestUtilsKt.transportToLegacyType; +import static com.android.server.ConnectivityServiceTestUtils.transportToLegacyType;  import static junit.framework.Assert.assertTrue; @@ -49,7 +49,7 @@ import android.os.Message;  import android.util.Log;  import com.android.server.connectivity.ConnectivityConstants; -import com.android.testutils.HandlerUtilsKt; +import com.android.testutils.HandlerUtils;  import com.android.testutils.TestableNetworkCallback;  import java.util.Set; @@ -265,6 +265,6 @@ public class NetworkAgentWrapper implements TestableNetworkCallback.HasNetwork {      }      public void waitForIdle(long timeoutMs) { -        HandlerUtilsKt.waitForIdle(mHandlerThread, timeoutMs); +        HandlerUtils.waitForIdle(mHandlerThread, timeoutMs);      }  } diff --git a/tests/net/java/android/net/ConnectivityDiagnosticsManagerTest.java b/tests/net/java/android/net/ConnectivityDiagnosticsManagerTest.java index 1d6c10766792..06e9405a6a79 100644 --- a/tests/net/java/android/net/ConnectivityDiagnosticsManagerTest.java +++ b/tests/net/java/android/net/ConnectivityDiagnosticsManagerTest.java @@ -21,7 +21,7 @@ import static android.net.ConnectivityDiagnosticsManager.ConnectivityDiagnostics  import static android.net.ConnectivityDiagnosticsManager.ConnectivityReport;  import static android.net.ConnectivityDiagnosticsManager.DataStallReport; -import static com.android.testutils.ParcelUtilsKt.assertParcelSane; +import static com.android.testutils.ParcelUtils.assertParcelSane;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse; diff --git a/tests/net/java/android/net/IpSecConfigTest.java b/tests/net/java/android/net/IpSecConfigTest.java index c9888b24b6da..25e225ef303a 100644 --- a/tests/net/java/android/net/IpSecConfigTest.java +++ b/tests/net/java/android/net/IpSecConfigTest.java @@ -16,8 +16,8 @@  package android.net; -import static com.android.testutils.ParcelUtilsKt.assertParcelSane; -import static com.android.testutils.ParcelUtilsKt.assertParcelingIsLossless; +import static com.android.testutils.ParcelUtils.assertParcelSane; +import static com.android.testutils.ParcelUtils.assertParcelingIsLossless;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertNotSame; diff --git a/tests/net/java/android/net/TcpKeepalivePacketDataTest.java b/tests/net/java/android/net/TcpKeepalivePacketDataTest.java index cea8c5713a6b..835a83e9ddc7 100644 --- a/tests/net/java/android/net/TcpKeepalivePacketDataTest.java +++ b/tests/net/java/android/net/TcpKeepalivePacketDataTest.java @@ -16,7 +16,7 @@  package android.net; -import static com.android.testutils.ParcelUtilsKt.assertParcelingIsLossless; +import static com.android.testutils.ParcelUtils.assertParcelingIsLossless;  import static org.junit.Assert.assertArrayEquals;  import static org.junit.Assert.assertEquals; diff --git a/tests/net/java/android/net/TelephonyNetworkSpecifierTest.java b/tests/net/java/android/net/TelephonyNetworkSpecifierTest.java index 47afed441ace..2bce612069bc 100644 --- a/tests/net/java/android/net/TelephonyNetworkSpecifierTest.java +++ b/tests/net/java/android/net/TelephonyNetworkSpecifierTest.java @@ -16,7 +16,7 @@  package android.net; -import static com.android.testutils.ParcelUtilsKt.assertParcelSane; +import static com.android.testutils.ParcelUtils.assertParcelSane;  import static org.junit.Assert.assertEquals; diff --git a/tests/net/java/android/net/nsd/NsdManagerTest.java b/tests/net/java/android/net/nsd/NsdManagerTest.java index cf7587a2039f..b0a9b8a55322 100644 --- a/tests/net/java/android/net/nsd/NsdManagerTest.java +++ b/tests/net/java/android/net/nsd/NsdManagerTest.java @@ -38,7 +38,7 @@ import androidx.test.filters.SmallTest;  import androidx.test.runner.AndroidJUnit4;  import com.android.internal.util.AsyncChannel; -import com.android.testutils.HandlerUtilsKt; +import com.android.testutils.HandlerUtils;  import org.junit.After;  import org.junit.Before; @@ -73,7 +73,7 @@ public class NsdManagerTest {      @After      public void tearDown() throws Exception { -        HandlerUtilsKt.waitForIdle(mServiceHandler, mTimeoutMs); +        HandlerUtils.waitForIdle(mServiceHandler, mTimeoutMs);          mServiceHandler.chan.disconnect();          mServiceHandler.stop();          if (mManager != null) { @@ -333,7 +333,7 @@ public class NsdManagerTest {      }      int verifyRequest(int expectedMessageType) { -        HandlerUtilsKt.waitForIdle(mServiceHandler, mTimeoutMs); +        HandlerUtils.waitForIdle(mServiceHandler, mTimeoutMs);          verify(mServiceHandler, timeout(mTimeoutMs)).handleMessage(any());          reset(mServiceHandler);          Message received = mServiceHandler.getLastMessage(); diff --git a/tests/net/java/com/android/internal/net/VpnProfileTest.java b/tests/net/java/com/android/internal/net/VpnProfileTest.java index e5daa71c30ea..46597d19ef1b 100644 --- a/tests/net/java/com/android/internal/net/VpnProfileTest.java +++ b/tests/net/java/com/android/internal/net/VpnProfileTest.java @@ -16,7 +16,7 @@  package com.android.internal.net; -import static com.android.testutils.ParcelUtilsKt.assertParcelSane; +import static com.android.testutils.ParcelUtils.assertParcelSane;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse; diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java index e6346ea52548..285cbe58f147 100644 --- a/tests/net/java/com/android/server/ConnectivityServiceTest.java +++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java @@ -78,16 +78,16 @@ import static android.net.RouteInfo.RTN_UNREACHABLE;  import static android.os.Process.INVALID_UID;  import static android.system.OsConstants.IPPROTO_TCP; -import static com.android.server.ConnectivityServiceTestUtilsKt.transportToLegacyType; -import static com.android.testutils.ConcurrentUtilsKt.await; -import static com.android.testutils.ConcurrentUtilsKt.durationOf; +import static com.android.server.ConnectivityServiceTestUtils.transportToLegacyType; +import static com.android.testutils.ConcurrentUtils.await; +import static com.android.testutils.ConcurrentUtils.durationOf;  import static com.android.testutils.ExceptionUtils.ignoreExceptions; -import static com.android.testutils.HandlerUtilsKt.waitForIdleSerialExecutor; -import static com.android.testutils.MiscAssertsKt.assertContainsExactly; -import static com.android.testutils.MiscAssertsKt.assertEmpty; -import static com.android.testutils.MiscAssertsKt.assertLength; -import static com.android.testutils.MiscAssertsKt.assertRunsInAtMost; -import static com.android.testutils.MiscAssertsKt.assertThrows; +import static com.android.testutils.HandlerUtils.waitForIdleSerialExecutor; +import static com.android.testutils.MiscAsserts.assertContainsExactly; +import static com.android.testutils.MiscAsserts.assertEmpty; +import static com.android.testutils.MiscAsserts.assertLength; +import static com.android.testutils.MiscAsserts.assertRunsInAtMost; +import static com.android.testutils.MiscAsserts.assertThrows;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse; @@ -242,7 +242,7 @@ import com.android.server.connectivity.Vpn;  import com.android.server.net.NetworkPinner;  import com.android.server.net.NetworkPolicyManagerInternal;  import com.android.testutils.ExceptionUtils; -import com.android.testutils.HandlerUtilsKt; +import com.android.testutils.HandlerUtils;  import com.android.testutils.RecorderCallback.CallbackEntry;  import com.android.testutils.TestableNetworkCallback; @@ -518,12 +518,12 @@ public class ConnectivityServiceTest {      }      private void waitForIdle() { -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS);          waitForIdle(mCellNetworkAgent, TIMEOUT_MS);          waitForIdle(mWiFiNetworkAgent, TIMEOUT_MS);          waitForIdle(mEthernetNetworkAgent, TIMEOUT_MS); -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); -        HandlerUtilsKt.waitForIdle(ConnectivityThread.get(), TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(ConnectivityThread.get(), TIMEOUT_MS);      }      private void waitForIdle(TestNetworkAgentWrapper agent, long timeoutMs) { @@ -614,8 +614,8 @@ public class ConnectivityServiceTest {              // Waits for the NetworkAgent to be registered, which includes the creation of the              // NetworkMonitor.              waitForIdle(TIMEOUT_MS); -            HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); -            HandlerUtilsKt.waitForIdle(ConnectivityThread.get(), TIMEOUT_MS); +            HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +            HandlerUtils.waitForIdle(ConnectivityThread.get(), TIMEOUT_MS);          }          @Override @@ -7099,7 +7099,7 @@ public class ConnectivityServiceTest {                  mConnectivityDiagnosticsCallback, wifiRequest, mContext.getPackageName());          // Block until all other events are done processing. -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS);          verify(mIBinder).linkToDeath(any(ConnectivityDiagnosticsCallbackInfo.class), anyInt());          verify(mConnectivityDiagnosticsCallback).asBinder(); @@ -7122,7 +7122,7 @@ public class ConnectivityServiceTest {                  mConnectivityDiagnosticsCallback, wifiRequest, mContext.getPackageName());          // Block until all other events are done processing. -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS);          verify(mIBinder).linkToDeath(any(ConnectivityDiagnosticsCallbackInfo.class), anyInt());          verify(mConnectivityDiagnosticsCallback).asBinder(); @@ -7133,7 +7133,7 @@ public class ConnectivityServiceTest {                  mConnectivityDiagnosticsCallback, wifiRequest, mContext.getPackageName());          // Block until all other events are done processing. -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS);          assertTrue(mService.mConnectivityDiagnosticsCallbacks.containsKey(mIBinder));      } @@ -7285,7 +7285,7 @@ public class ConnectivityServiceTest {                  mConnectivityDiagnosticsCallback, request, mContext.getPackageName());          // Block until all other events are done processing. -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS);          verify(mConnectivityDiagnosticsCallback)                  .onConnectivityReportAvailable(argThat(report -> { @@ -7305,7 +7305,7 @@ public class ConnectivityServiceTest {                  mConnectivityDiagnosticsCallback, request, mContext.getPackageName());          // Block until all other events are done processing. -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS);          // Connect the cell agent verify that it notifies TestNetworkCallback that it is available          final TestNetworkCallback callback = new TestNetworkCallback(); @@ -7322,7 +7322,7 @@ public class ConnectivityServiceTest {          setUpConnectivityDiagnosticsCallback();          // Block until all other events are done processing. -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS);          // Verify onConnectivityReport fired          verify(mConnectivityDiagnosticsCallback).onConnectivityReportAvailable( @@ -7343,7 +7343,7 @@ public class ConnectivityServiceTest {          mCellNetworkAgent.notifyDataStallSuspected();          // Block until all other events are done processing. -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS);          // Verify onDataStallSuspected fired          verify(mConnectivityDiagnosticsCallback).onDataStallSuspected( @@ -7364,7 +7364,7 @@ public class ConnectivityServiceTest {          mService.reportNetworkConnectivity(n, hasConnectivity);          // Block until all other events are done processing. -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS);          // Verify onNetworkConnectivityReported fired          verify(mConnectivityDiagnosticsCallback) @@ -7374,7 +7374,7 @@ public class ConnectivityServiceTest {          mService.reportNetworkConnectivity(n, noConnectivity);          // Block until all other events are done processing. -        HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS); +        HandlerUtils.waitForIdle(mCsHandlerThread, TIMEOUT_MS);          // Wait for onNetworkConnectivityReported to fire          verify(mConnectivityDiagnosticsCallback) diff --git a/tests/net/java/com/android/server/connectivity/DnsManagerTest.java b/tests/net/java/com/android/server/connectivity/DnsManagerTest.java index 508b5cd9cb19..753dbf80b449 100644 --- a/tests/net/java/com/android/server/connectivity/DnsManagerTest.java +++ b/tests/net/java/com/android/server/connectivity/DnsManagerTest.java @@ -26,9 +26,9 @@ import static android.provider.Settings.Global.PRIVATE_DNS_DEFAULT_MODE;  import static android.provider.Settings.Global.PRIVATE_DNS_MODE;  import static android.provider.Settings.Global.PRIVATE_DNS_SPECIFIER; -import static com.android.testutils.MiscAssertsKt.assertContainsExactly; -import static com.android.testutils.MiscAssertsKt.assertContainsStringsExactly; -import static com.android.testutils.MiscAssertsKt.assertFieldCountEquals; +import static com.android.testutils.MiscAsserts.assertContainsExactly; +import static com.android.testutils.MiscAsserts.assertContainsStringsExactly; +import static com.android.testutils.MiscAsserts.assertFieldCountEquals;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertFalse; diff --git a/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java b/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java index aef9386755d7..8ccea1aa3474 100644 --- a/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java +++ b/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java @@ -19,7 +19,7 @@ package com.android.server.connectivity;  import static android.net.metrics.INetdEventListener.EVENT_GETADDRINFO;  import static android.net.metrics.INetdEventListener.EVENT_GETHOSTBYNAME; -import static com.android.testutils.MiscAssertsKt.assertStringContains; +import static com.android.testutils.MiscAsserts.assertStringContains;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.fail; diff --git a/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java b/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java index 79343de3b3bf..912460a1b172 100644 --- a/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java +++ b/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java @@ -28,11 +28,17 @@ import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_PRODUCT;  import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_VENDOR;  import static android.content.pm.PackageManager.GET_PERMISSIONS;  import static android.content.pm.PackageManager.MATCH_ANY_USER; +import static android.net.INetd.PERMISSION_INTERNET; +import static android.net.INetd.PERMISSION_NONE; +import static android.net.INetd.PERMISSION_SYSTEM; +import static android.net.INetd.PERMISSION_UNINSTALLED; +import static android.net.INetd.PERMISSION_UPDATE_DEVICE_STATS;  import static android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK;  import static android.os.Process.SYSTEM_UID;  import static com.android.server.connectivity.PermissionMonitor.NETWORK;  import static com.android.server.connectivity.PermissionMonitor.SYSTEM; +import static com.android.server.connectivity.PermissionMonitor.UidNetdPermissionInfo;  import static junit.framework.Assert.fail; @@ -64,7 +70,7 @@ import android.net.UidRange;  import android.os.Build;  import android.os.UserHandle;  import android.os.UserManager; -import android.util.SparseIntArray; +import android.util.SparseArray;  import androidx.test.InstrumentationRegistry;  import androidx.test.filters.SmallTest; @@ -312,7 +318,7 @@ public class PermissionMonitorTest {              // Add hook to verify and track result of setPermission.              doAnswer((InvocationOnMock invocation) -> {                  final Object[] args = invocation.getArguments(); -                final Boolean isSystem = args[0].equals(INetd.PERMISSION_SYSTEM); +                final Boolean isSystem = args[0].equals(PERMISSION_SYSTEM);                  for (final int uid : (int[]) args[1]) {                      // TODO: Currently, permission monitor will send duplicate commands for each uid                      // corresponding to each user. Need to fix that and uncomment below test. @@ -555,39 +561,40 @@ public class PermissionMonitorTest {          // SYSTEM_UID1: SYSTEM_PACKAGE1 has internet permission and update device stats permission.          // SYSTEM_UID2: SYSTEM_PACKAGE2 has only update device stats permission. -        SparseIntArray netdPermissionsAppIds = new SparseIntArray(); -        netdPermissionsAppIds.put(MOCK_UID1, INetd.PERMISSION_INTERNET); -        netdPermissionsAppIds.put(MOCK_UID2, INetd.PERMISSION_NONE); -        netdPermissionsAppIds.put(SYSTEM_UID1, INetd.PERMISSION_INTERNET -                | INetd.PERMISSION_UPDATE_DEVICE_STATS); -        netdPermissionsAppIds.put(SYSTEM_UID2, INetd.PERMISSION_UPDATE_DEVICE_STATS); +        final SparseArray<UidNetdPermissionInfo> uidsPermInfo = new SparseArray<>(); +        uidsPermInfo.put(MOCK_UID1, new UidNetdPermissionInfo(PERMISSION_INTERNET)); +        uidsPermInfo.put(MOCK_UID2, new UidNetdPermissionInfo(PERMISSION_NONE)); +        uidsPermInfo.put(SYSTEM_UID1, new UidNetdPermissionInfo( +                PERMISSION_INTERNET | PERMISSION_UPDATE_DEVICE_STATS)); +        uidsPermInfo.put(SYSTEM_UID2, new UidNetdPermissionInfo(PERMISSION_UPDATE_DEVICE_STATS));          // Send the permission information to netd, expect permission updated. -        mPermissionMonitor.sendPackagePermissionsToNetd(netdPermissionsAppIds); +        mPermissionMonitor.sendPackagePermissionsToNetd(uidsPermInfo); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET, +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET,                  new int[]{MOCK_UID1}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_NONE, new int[]{MOCK_UID2}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET -                | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{SYSTEM_UID1}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_UPDATE_DEVICE_STATS, +        mNetdServiceMonitor.expectPermission(PERMISSION_NONE, new int[]{MOCK_UID2}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET +                | PERMISSION_UPDATE_DEVICE_STATS, new int[]{SYSTEM_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_UPDATE_DEVICE_STATS,                  new int[]{SYSTEM_UID2});          // Update permission of MOCK_UID1, expect new permission show up. -        mPermissionMonitor.sendPackagePermissionsForUid(MOCK_UID1, -                INetd.PERMISSION_INTERNET | INetd.PERMISSION_UPDATE_DEVICE_STATS); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET -                | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1}); +        mPermissionMonitor.sendPackagePermissionsForUid(MOCK_UID1, new UidNetdPermissionInfo( +                PERMISSION_INTERNET | PERMISSION_UPDATE_DEVICE_STATS)); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET +                | PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});          // Change permissions of SYSTEM_UID2, expect new permission show up and old permission          // revoked. -        mPermissionMonitor.sendPackagePermissionsForUid(SYSTEM_UID2, -                INetd.PERMISSION_INTERNET); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET, new int[]{SYSTEM_UID2}); +        mPermissionMonitor.sendPackagePermissionsForUid(SYSTEM_UID2, new UidNetdPermissionInfo( +                PERMISSION_INTERNET)); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET, new int[]{SYSTEM_UID2});          // Revoke permission from SYSTEM_UID1, expect no permission stored. -        mPermissionMonitor.sendPackagePermissionsForUid(SYSTEM_UID1, INetd.PERMISSION_NONE); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_NONE, new int[]{SYSTEM_UID1}); +        mPermissionMonitor.sendPackagePermissionsForUid(SYSTEM_UID1, new UidNetdPermissionInfo( +                PERMISSION_NONE)); +        mNetdServiceMonitor.expectPermission(PERMISSION_NONE, new int[]{SYSTEM_UID1});      }      private PackageInfo setPackagePermissions(String packageName, int uid, String[] permissions) @@ -611,11 +618,11 @@ public class PermissionMonitorTest {          final NetdServiceMonitor mNetdServiceMonitor = new NetdServiceMonitor(mNetdService);          addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET, UPDATE_DEVICE_STATS}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET -                | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET +                | PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});          addPackage(MOCK_PACKAGE2, MOCK_UID2, new String[] {INTERNET}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET, new int[]{MOCK_UID2}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET, new int[]{MOCK_UID2});      }      @Test @@ -623,8 +630,8 @@ public class PermissionMonitorTest {          final NetdServiceMonitor mNetdServiceMonitor = new NetdServiceMonitor(mNetdService);          addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET, UPDATE_DEVICE_STATS}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET -                | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET +                | PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});          // Install another package with the same uid and no permissions should not cause the UID to          // lose permissions. @@ -633,8 +640,8 @@ public class PermissionMonitorTest {          when(mPackageManager.getPackagesForUid(MOCK_UID1))                .thenReturn(new String[]{MOCK_PACKAGE1, MOCK_PACKAGE2});          mPermissionMonitor.onPackageAdded(MOCK_PACKAGE2, MOCK_UID1); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET -                | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET +                | PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});      }      @Test @@ -642,12 +649,12 @@ public class PermissionMonitorTest {          final NetdServiceMonitor mNetdServiceMonitor = new NetdServiceMonitor(mNetdService);          addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET, UPDATE_DEVICE_STATS}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET -                | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET +                | PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});          when(mPackageManager.getPackagesForUid(MOCK_UID1)).thenReturn(new String[]{});          mPermissionMonitor.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_UNINSTALLED, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_UNINSTALLED, new int[]{MOCK_UID1});      }      @Test @@ -655,16 +662,16 @@ public class PermissionMonitorTest {          final NetdServiceMonitor mNetdServiceMonitor = new NetdServiceMonitor(mNetdService);          addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET, UPDATE_DEVICE_STATS}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET -                | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET +                | PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});          when(mPackageManager.getPackagesForUid(MOCK_UID1)).thenReturn(new String[]{});          removeAllPermissions(MOCK_UID1);          mPermissionMonitor.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_UNINSTALLED, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_UNINSTALLED, new int[]{MOCK_UID1});          addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET, new int[]{MOCK_UID1});      }      @Test @@ -672,10 +679,10 @@ public class PermissionMonitorTest {          final NetdServiceMonitor mNetdServiceMonitor = new NetdServiceMonitor(mNetdService);          addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_NONE, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_NONE, new int[]{MOCK_UID1});          addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET, new int[]{MOCK_UID1});      }      @Test @@ -683,8 +690,8 @@ public class PermissionMonitorTest {          final NetdServiceMonitor mNetdServiceMonitor = new NetdServiceMonitor(mNetdService);          addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET, UPDATE_DEVICE_STATS}); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET -                | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET +                | PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});          // Mock another package with the same uid but different permissions.          final PackageInfo packageInfo2 = buildPackageInfo(PARTITION_SYSTEM, MOCK_UID1, MOCK_USER1); @@ -695,7 +702,7 @@ public class PermissionMonitorTest {          addPermissions(MOCK_UID1, INTERNET);          mPermissionMonitor.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1); -        mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET, new int[]{MOCK_UID1}); +        mNetdServiceMonitor.expectPermission(PERMISSION_INTERNET, new int[]{MOCK_UID1});      }      @Test diff --git a/tests/net/java/com/android/server/connectivity/VpnTest.java b/tests/net/java/com/android/server/connectivity/VpnTest.java index de1c5759ee87..e8c4ee9c628d 100644 --- a/tests/net/java/com/android/server/connectivity/VpnTest.java +++ b/tests/net/java/com/android/server/connectivity/VpnTest.java @@ -270,12 +270,12 @@ public class VpnTest {      }      @Test -    public void testUidWhiteAndBlacklist() throws Exception { +    public void testUidAllowAndDenylist() throws Exception {          final Vpn vpn = createVpn(primaryUser.id);          final UidRange user = UidRange.createForUser(primaryUser.id);          final String[] packages = {PKGS[0], PKGS[1], PKGS[2]}; -        // Whitelist +        // Allowed list          final Set<UidRange> allow = vpn.createUserAndRestrictedProfilesRanges(primaryUser.id,                  Arrays.asList(packages), null);          assertEquals(new ArraySet<>(Arrays.asList(new UidRange[] { @@ -283,7 +283,7 @@ public class VpnTest {              new UidRange(user.start + PKG_UIDS[1], user.start + PKG_UIDS[2])          })), allow); -        // Blacklist +        // Denied list          final Set<UidRange> disallow = vpn.createUserAndRestrictedProfilesRanges(primaryUser.id,                  null, Arrays.asList(packages));          assertEquals(new ArraySet<>(Arrays.asList(new UidRange[] { @@ -354,11 +354,11 @@ public class VpnTest {      }      @Test -    public void testLockdownWhitelist() throws Exception { +    public void testLockdownAllowlist() throws Exception {          final Vpn vpn = createVpn(primaryUser.id);          final UidRange user = UidRange.createForUser(primaryUser.id); -        // Set always-on with lockdown and whitelist app PKGS[2] from lockdown. +        // Set always-on with lockdown and allow app PKGS[2] from lockdown.          assertTrue(vpn.setAlwaysOnPackage(                  PKGS[1], true, Collections.singletonList(PKGS[2]), mKeyStore));          verify(mNetService).setAllowOnlyVpnForUids(eq(true), aryEq(new UidRange[] { @@ -368,7 +368,7 @@ public class VpnTest {          assertBlocked(vpn, user.start + PKG_UIDS[0], user.start + PKG_UIDS[3]);          assertUnblocked(vpn, user.start + PKG_UIDS[1], user.start + PKG_UIDS[2]); -        // Change whitelisted app to PKGS[3]. +        // Change allowed app list to PKGS[3].          assertTrue(vpn.setAlwaysOnPackage(                  PKGS[1], true, Collections.singletonList(PKGS[3]), mKeyStore));          verify(mNetService).setAllowOnlyVpnForUids(eq(false), aryEq(new UidRange[] { @@ -395,7 +395,7 @@ public class VpnTest {          assertBlocked(vpn, user.start + PKG_UIDS[1], user.start + PKG_UIDS[2]);          assertUnblocked(vpn, user.start + PKG_UIDS[0], user.start + PKG_UIDS[3]); -        // Remove the whitelist. +        // Remove the list of allowed packages.          assertTrue(vpn.setAlwaysOnPackage(PKGS[0], true, null, mKeyStore));          verify(mNetService).setAllowOnlyVpnForUids(eq(false), aryEq(new UidRange[] {                  new UidRange(user.start + PKG_UIDS[0] + 1, user.start + PKG_UIDS[3] - 1), @@ -408,7 +408,7 @@ public class VpnTest {                  user.start + PKG_UIDS[3]);          assertUnblocked(vpn, user.start + PKG_UIDS[0]); -        // Add the whitelist. +        // Add the list of allowed packages.          assertTrue(vpn.setAlwaysOnPackage(                  PKGS[0], true, Collections.singletonList(PKGS[1]), mKeyStore));          verify(mNetService).setAllowOnlyVpnForUids(eq(false), aryEq(new UidRange[] { @@ -421,12 +421,12 @@ public class VpnTest {          assertBlocked(vpn, user.start + PKG_UIDS[2], user.start + PKG_UIDS[3]);          assertUnblocked(vpn, user.start + PKG_UIDS[0], user.start + PKG_UIDS[1]); -        // Try whitelisting a package with a comma, should be rejected. +        // Try allowing a package with a comma, should be rejected.          assertFalse(vpn.setAlwaysOnPackage(                  PKGS[0], true, Collections.singletonList("a.b,c.d"), mKeyStore)); -        // Pass a non-existent packages in the whitelist, they (and only they) should be ignored. -        // Whitelisted package should change from PGKS[1] to PKGS[2]. +        // Pass a non-existent packages in the allowlist, they (and only they) should be ignored. +        // allowed package should change from PGKS[1] to PKGS[2].          assertTrue(vpn.setAlwaysOnPackage(                  PKGS[0], true, Arrays.asList("com.foo.app", PKGS[2], "com.bar.app"), mKeyStore));          verify(mNetService).setAllowOnlyVpnForUids(eq(false), aryEq(new UidRange[]{ diff --git a/tests/net/java/com/android/server/net/NetworkStatsCollectionTest.java b/tests/net/java/com/android/server/net/NetworkStatsCollectionTest.java index e83d2a90bffa..fb0cfc0d50ba 100644 --- a/tests/net/java/com/android/server/net/NetworkStatsCollectionTest.java +++ b/tests/net/java/com/android/server/net/NetworkStatsCollectionTest.java @@ -28,7 +28,7 @@ import static android.os.Process.myUid;  import static android.text.format.DateUtils.HOUR_IN_MILLIS;  import static android.text.format.DateUtils.MINUTE_IN_MILLIS; -import static com.android.testutils.MiscAssertsKt.assertThrows; +import static com.android.testutils.MiscAsserts.assertThrows;  import static org.junit.Assert.assertArrayEquals;  import static org.junit.Assert.assertEquals; diff --git a/tests/net/java/com/android/server/net/NetworkStatsObserversTest.java b/tests/net/java/com/android/server/net/NetworkStatsObserversTest.java index a6f7a36ff01b..291efc74aa47 100644 --- a/tests/net/java/com/android/server/net/NetworkStatsObserversTest.java +++ b/tests/net/java/com/android/server/net/NetworkStatsObserversTest.java @@ -53,7 +53,7 @@ import androidx.test.filters.SmallTest;  import androidx.test.runner.AndroidJUnit4;  import com.android.server.net.NetworkStatsServiceTest.LatchedHandler; -import com.android.testutils.HandlerUtilsKt; +import com.android.testutils.HandlerUtils;  import org.junit.Before;  import org.junit.Test; @@ -440,7 +440,7 @@ public class NetworkStatsObserversTest {      }      private void waitForObserverToIdle() { -        HandlerUtilsKt.waitForIdle(mObserverHandlerThread, WAIT_TIMEOUT_MS); -        HandlerUtilsKt.waitForIdle(mHandler, WAIT_TIMEOUT_MS); +        HandlerUtils.waitForIdle(mObserverHandlerThread, WAIT_TIMEOUT_MS); +        HandlerUtils.waitForIdle(mHandler, WAIT_TIMEOUT_MS);      }  } diff --git a/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java b/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java index 1307a849f1eb..7abe1893dd9e 100644 --- a/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java +++ b/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java @@ -109,7 +109,7 @@ import com.android.internal.util.ArrayUtils;  import com.android.internal.util.test.BroadcastInterceptingContext;  import com.android.server.net.NetworkStatsService.NetworkStatsSettings;  import com.android.server.net.NetworkStatsService.NetworkStatsSettings.Config; -import com.android.testutils.HandlerUtilsKt; +import com.android.testutils.HandlerUtils;  import com.android.testutils.TestableNetworkStatsProviderBinder;  import libcore.io.IoUtils; @@ -700,7 +700,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {          when(mNetworkStatsSubscriptionsMonitor.getRatTypeForSubscriberId(anyString()))                  .thenReturn(ratType);          mService.handleOnCollapsedRatTypeChanged(); -        HandlerUtilsKt.waitForIdle(mHandlerThread, WAIT_TIMEOUT); +        HandlerUtils.waitForIdle(mHandlerThread, WAIT_TIMEOUT);      }      @Test @@ -1065,7 +1065,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {          long minThresholdInBytes = 2 * 1024 * 1024; // 2 MB          assertEquals(minThresholdInBytes, request.thresholdInBytes); -        HandlerUtilsKt.waitForIdle(mHandlerThread, WAIT_TIMEOUT); +        HandlerUtils.waitForIdle(mHandlerThread, WAIT_TIMEOUT);          // Make sure that the caller binder gets connected          verify(mBinder).linkToDeath(any(IBinder.DeathRecipient.class), anyInt()); @@ -1203,7 +1203,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {          // Simulates alert quota of the provider has been reached.          cb.notifyAlertReached(); -        HandlerUtilsKt.waitForIdle(mHandlerThread, WAIT_TIMEOUT); +        HandlerUtils.waitForIdle(mHandlerThread, WAIT_TIMEOUT);          // Verifies that polling is triggered by alert reached.          provider.expectOnRequestStatsUpdate(0 /* unused */); @@ -1264,7 +1264,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {          // Call handleOnCollapsedRatTypeChanged manually to simulate the callback fired          // when stopping monitor, this is needed by NetworkStatsService to trigger updateIfaces.          mService.handleOnCollapsedRatTypeChanged(); -        HandlerUtilsKt.waitForIdle(mHandlerThread, WAIT_TIMEOUT); +        HandlerUtils.waitForIdle(mHandlerThread, WAIT_TIMEOUT);          // Create some traffic.          incrementCurrentTime(MINUTE_IN_MILLIS);          // Append more traffic on existing snapshot. @@ -1286,7 +1286,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {          setCombineSubtypeEnabled(false);          mService.handleOnCollapsedRatTypeChanged(); -        HandlerUtilsKt.waitForIdle(mHandlerThread, WAIT_TIMEOUT); +        HandlerUtils.waitForIdle(mHandlerThread, WAIT_TIMEOUT);          // Create some traffic.          incrementCurrentTime(MINUTE_IN_MILLIS);          // Append more traffic on existing snapshot. @@ -1520,7 +1520,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {      }      private void waitForIdle() { -        HandlerUtilsKt.waitForIdle(mHandlerThread, WAIT_TIMEOUT); +        HandlerUtils.waitForIdle(mHandlerThread, WAIT_TIMEOUT);      }      static class LatchedHandler extends Handler { diff --git a/tools/hiddenapi/generate_hiddenapi_lists.py b/tools/hiddenapi/generate_hiddenapi_lists.py index 8a282e5f0821..da644021e30e 100755 --- a/tools/hiddenapi/generate_hiddenapi_lists.py +++ b/tools/hiddenapi/generate_hiddenapi_lists.py @@ -34,26 +34,6 @@ FLAG_PUBLIC_API = 'public-api'  FLAG_SYSTEM_API = 'system-api'  FLAG_TEST_API = 'test-api' -OLD_FLAG_SDK = "whitelist" -OLD_FLAG_UNSUPPORTED = "greylist" -OLD_FLAG_BLOCKED = "blacklist" -OLD_FLAG_MAX_TARGET_O = "greylist-max-o" -OLD_FLAG_MAX_TARGET_P = "greylist-max-p" -OLD_FLAG_MAX_TARGET_Q = "greylist-max-q" -OLD_FLAG_MAX_TARGET_R = "greylist-max-r" - -OLD_FLAGS_TO_NEW = { -    OLD_FLAG_SDK: FLAG_SDK, -    OLD_FLAG_UNSUPPORTED: FLAG_UNSUPPORTED, -    OLD_FLAG_BLOCKED: FLAG_BLOCKED, -    OLD_FLAG_MAX_TARGET_O: FLAG_MAX_TARGET_O, -    OLD_FLAG_MAX_TARGET_P: FLAG_MAX_TARGET_P, -    OLD_FLAG_MAX_TARGET_Q: FLAG_MAX_TARGET_Q, -    OLD_FLAG_MAX_TARGET_R: FLAG_MAX_TARGET_R, -} - -NEW_FLAGS_TO_OLD = dict(zip(OLD_FLAGS_TO_NEW.values(), OLD_FLAGS_TO_NEW.keys())) -  # List of all known flags.  FLAGS_API_LIST = [      FLAG_SDK, @@ -205,36 +185,6 @@ class FlagsDict:              "Please visit go/hiddenapi for more information.").format(                  source, "\n".join(flags_subset - ALL_FLAGS_SET)) -    def convert_to_new_flag(self, flag): -      """Converts old flag to a new variant. - -      Flags that are considered old are replaced with new versions. -      Otherwise, it is a no-op. - -      Args: -        flag: a string, representing SDK flag. - -      Returns: -         A string. Result of conversion. - -      """ -      return OLD_FLAGS_TO_NEW.get(flag, flag) - -    def convert_to_old_flag(self, flag): -      """Converts a new flag to a old variant. - -      No-op if there is no suitable old flag. -      Only used to support backwards compatibility. - -      Args: -        flag: a string, representing SDK flag. - -      Returns: -         A string. Result of conversion. - -      """ -      return NEW_FLAGS_TO_OLD.get(flag, flag) -      def filter_apis(self, filter_fn):          """Returns APIs which match a given predicate. @@ -272,7 +222,7 @@ class FlagsDict:          """          lines = []          for api in self._dict: -          flags = sorted([self.convert_to_old_flag(flag) for flag in self._dict[api]]) +          flags = sorted(self._dict[api])            lines.append(",".join([api] + flags))          return sorted(lines) @@ -298,12 +248,12 @@ class FlagsDict:          # Check that all flags are known.          csv_flags = set()          for csv in csv_values: -          csv_flags.update([self.convert_to_new_flag(flag) for flag in csv[1:]]) +          csv_flags.update(csv[1:])          self._check_flags_set(csv_flags, source)          # Iterate over all CSV lines, find entry in dict and append flags to it.          for csv in csv_values: -            flags = [self.convert_to_new_flag(flag) for flag in csv[1:]] +            flags = csv[1:]              if (FLAG_PUBLIC_API in flags) or (FLAG_SYSTEM_API in flags):                  flags.append(FLAG_SDK)              self._dict[csv[0]].update(flags) diff --git a/tools/hiddenapi/generate_hiddenapi_lists_test.py b/tools/hiddenapi/generate_hiddenapi_lists_test.py index 321c400ef898..82d117fbbbab 100755 --- a/tools/hiddenapi/generate_hiddenapi_lists_test.py +++ b/tools/hiddenapi/generate_hiddenapi_lists_test.py @@ -35,7 +35,7 @@ class TestHiddenapiListGeneration(unittest.TestCase):          flags.parse_and_merge_csv(['A,' + FLAG_SDK, 'B', 'C'])          flags.assign_flag(FLAG_UNSUPPORTED, set(['C']))          self.assertEqual(flags.generate_csv(), -            [ 'A,' + OLD_FLAG_SDK, 'B', 'C,' + OLD_FLAG_UNSUPPORTED ]) +            [ 'A,' + FLAG_SDK, 'B', 'C,' + FLAG_UNSUPPORTED ])          # Check three things:          # (1) B is selected as valid unassigned @@ -50,8 +50,7 @@ class TestHiddenapiListGeneration(unittest.TestCase):          # Test empty CSV entry.          self.assertEqual(flags.generate_csv(), []) -        # Test new additions. CSV generator produces values with old flags -        # to be backwards compatible. +        # Test new additions.          flags.parse_and_merge_csv([              'A,' + FLAG_UNSUPPORTED,              'B,' + FLAG_BLOCKED + ',' + FLAG_MAX_TARGET_O, @@ -60,11 +59,11 @@ class TestHiddenapiListGeneration(unittest.TestCase):              'E,' + FLAG_BLOCKED + ',' + FLAG_TEST_API,          ])          self.assertEqual(flags.generate_csv(), [ -            'A,' + OLD_FLAG_UNSUPPORTED, -            'B,' + OLD_FLAG_BLOCKED + "," + OLD_FLAG_MAX_TARGET_O, -            'C,' + FLAG_SYSTEM_API + ',' + OLD_FLAG_SDK, -            'D,' + OLD_FLAG_UNSUPPORTED + ',' + FLAG_TEST_API, -            'E,' + OLD_FLAG_BLOCKED + ',' + FLAG_TEST_API, +            'A,' + FLAG_UNSUPPORTED, +            'B,' + FLAG_BLOCKED + "," + FLAG_MAX_TARGET_O, +            'C,' + FLAG_SYSTEM_API + ',' + FLAG_SDK, +            'D,' + FLAG_UNSUPPORTED + ',' + FLAG_TEST_API, +            'E,' + FLAG_BLOCKED + ',' + FLAG_TEST_API,          ])          # Test unknown flag. @@ -78,7 +77,7 @@ class TestHiddenapiListGeneration(unittest.TestCase):          # Test new additions.          flags.assign_flag(FLAG_UNSUPPORTED, set([ 'A', 'B' ]))          self.assertEqual(flags.generate_csv(), -            [ 'A,' + OLD_FLAG_UNSUPPORTED + "," + OLD_FLAG_SDK, 'B,' + OLD_FLAG_UNSUPPORTED ]) +            [ 'A,' + FLAG_UNSUPPORTED + "," + FLAG_SDK, 'B,' + FLAG_UNSUPPORTED ])          # Test invalid API signature.          with self.assertRaises(AssertionError): diff --git a/wifi/tests/src/android/net/wifi/WifiClientTest.java b/wifi/tests/src/android/net/wifi/WifiClientTest.java index 42cab55305b9..7a3baf9ebaf2 100644 --- a/wifi/tests/src/android/net/wifi/WifiClientTest.java +++ b/wifi/tests/src/android/net/wifi/WifiClientTest.java @@ -16,8 +16,8 @@  package android.net.wifi; -import static com.android.testutils.MiscAssertsKt.assertFieldCountEquals; -import static com.android.testutils.ParcelUtilsKt.assertParcelSane; +import static com.android.testutils.MiscAsserts.assertFieldCountEquals; +import static com.android.testutils.ParcelUtils.assertParcelSane;  import static org.junit.Assert.assertEquals;  import static org.junit.Assert.assertNotEquals; |