Skip to content
Snippets Groups Projects
  1. Oct 06, 2023
    • Eric Biggers's avatar
      Rename CanUnlockWithActiveUnlockTest.kt · a9826c8c
      Eric Biggers authored
      The name of this source file does not match the test class it contains.
      Rename the source file to match the test class.
      
      Flag: TEST_ONLY
      Test: atest TrustTests
      Change-Id: Ib1b4bbcf980545dd0ee7b08951185d4038954e37
      Merged-In: Ib1b4bbcf980545dd0ee7b08951185d4038954e37
      (cherry picked from commit 2e98f22c)
      a9826c8c
  2. Sep 25, 2023
    • Jiyong Park's avatar
      binder: fix death recipient leak for apps targeting >= V · 646cc266
      Jiyong Park authored
      Before this change, when a death recipient is set on a binder proxy via
      linkToDeath, a JNI global ref to the recipient object was created. That
      global ref is cleared only when unlinkToDeath is explicitly called or
      binderDied is notified.
      
      In addition, since binderDied didn't give the IBinder which has died,
      people has kept a strong reference to IBinder in the death recipient
      object. Ex:
      
      class FooHolder implements Binder.DeathRecipient {
          private IFoo mFoo;
          public FooHolder(IFoo foo) {
              mFoo = foo; // this!!!
              mFoo.linkToDeath(this, 0);
          }
          @Override
          public void binderDied() {
              // know that IFoo has died
          }
      }
      
      Unfortunately, this is prone to leak. Even if there's no reference to
      FooHolder in your program, it is kept in memory due to the JNI global
      ref as mentioned above. It means that you keep IFoo as well, and that
      in turn keeps the binder service in the remote side. As a result,
      binderDied will never be called (well, except when the server process
      crashes).
      
      The only way to release this object is calling unlinkToDeath explicitly
      when you drop references to FooHolder. However, it's error prone and
      keeping that practice is hard to be enforced.
      
      Recently, the need for this pattern has become weaker as we introduced
      binderDied(IBinder who). However, the API is quite new and its use is
      not mandated. There still are many cases where this pattern is used.
      
      This change is an attempt to fix the issue without having to touch the
      existing uses. The idea is to change the way that death recipient
      objects are strongly referenced - depending on whether you are targeting
      Android V+ or not.
      
      If targeting Android V+, the death recipient object is "weakly"
      referenced from JNI. Instead, it is "strongly" referenced from the
      BinderProxy object it is registered at. This means that if you drop
      a BinderProxy object, you are dropping its death recipients as well,
      unless you keep references to the recipients separately.
      
      For apps targeting pre-V versions, we keep the JNI strong reference.
      
      An important implication of this is that you won't get binderDied if you
      drop BinderProxy object before the binder actually dies. This actually
      is the documented behavior and has been the actual behavior "if you
      don't use the FooHolder pattern mentioned above". I'd argue that this CL
      fixes the undocumented incorrect behavior. However, we should be
      conservative when making any behavioral change, thus we are hiding this
      change behind the target SDK level.
      
      Bug: 298374304
      Test: atest BinderLeakTest BinderLeakTest_legacy
      
      Change-Id: Ibb371f4de45530670d5f783f8ead8404c39381b4
      646cc266
  3. Sep 13, 2023
    • Pete Bentley's avatar
      Fix up NetworkSecurityConfigTests. · a14b9b34
      Pete Bentley authored
      * Outdated defaults for plain HTTP.
      * Replaced expired test pins with the current intermediate.
      issuer cert for android.com.
      * Replaced obsolete trust anchors with a single GTS Root cert.
      * Fixed connection tests to use startHandshake() not getInputStream().
      * Made checkstyle happier.
      
      Would have converted to JUnit4 too, but unsure how to
      migrate ActivityUnitTestCase correctly.
      
      Bug: 259406200
      Test: NetworkSecurityConfigTests
      Change-Id: I385fc4bb67cd937e9e5f7b291f2cee37fd9ad715
      a14b9b34
  4. Sep 11, 2023
  5. Sep 08, 2023
    • Eric Biggers's avatar
      Fix refreshDeviceLockedForUser() to use correct trust state · c6772277
      Eric Biggers authored
      TrustManagerService#refreshDeviceLockedForUser() incorrectly considers
      the device to be unlocked by a trust agent whenever a trust agent has
      granted trust.  This ignores the conditions that
      TrustManagerService#updateTrust() has for recognizing trust grants.
      This code used to be correct, but it became incorrect in Android 10 when
      trust agents were made to extend unlock rather than actively unlock.
      
      The correct state is sent to Keyguard, while the incorrect state is sent
      to Keystore.  This would cause UnlockedDeviceRequired keys to sometimes
      be usable when the device is locked, though since Android 12 this bug is
      hidden by other bugs with UnlockedDeviceRequired keys that make them
      unusable in many cases.  However, these bugs are planned to be fixed.
      
      Therefore, fix this bug by making refreshDeviceLockedForUser() use
      mUserTrustState, which holds the user's authoritative trust state.
      
      Bug: 296464083
      Bug: 298249081
      Flag: 296464083
      Test: adb shell device_config put hardware_backed_security android.security.fix_unlocked_device_required_keys true
            atest TrustTests
            adb shell device_config put hardware_backed_security android.security.fix_unlocked_device_required_keys false
            atest TrustTests
      Change-Id: I0880685c23ebe71a799671fa611fafb42642fa83
      c6772277
    • Colin Cross's avatar
      Fix kotlin nullable errors in TrustTests · 5f70c172
      Colin Cross authored
      Fix kotlin nullable errors that were exposed by setting the retention
      of android.annotation.NonNull and android.annotation.Nullable to
      class retention.
      
      Bug: 294110802
      Test: builds
      Change-Id: I31c4f4d256ff8dd2b6ed1f6ed74844ccaf7a4814
      Merged-In: I31c4f4d256ff8dd2b6ed1f6ed74844ccaf7a4814
      (cherry picked from commit c5a0cfdd)
      5f70c172
    • Eric Biggers's avatar
      Improve LockStateTrackingRule · 37873686
      Eric Biggers authored
      - Make assertLocked and assertUnlocked check
        KeyguardManager#isDeviceLocked, in addition to what they were checking
        before.  This is important, as this verifies what TrustManagerService
        (and thus also Keystore) considers the device locked state to be.
      
      - Rename assertUnlocked to assertUnlockedAndTrusted.  This makes it
        clear that it checks for trusted (which implies unlocked), not just
        unlocked (which does not necessarily imply trusted).
      
      - Rename the inner class LockState to TrustState.  This makes it clear
        what it actually is.
      
      - Improve the class comment.
      
      Bug: 296464083
      Bug: 298249081
      Flag: TEST_ONLY
      Test: atest TrustTests
      Change-Id: I865ec19dff7ebe00ff083da29154e3c9cb846574
      37873686
  6. Sep 07, 2023
    • Bryce Lee's avatar
      Notify TrustListeners when enabled trust agents change. · c3522c19
      Bryce Lee authored
      This change adds a new callback from TrustManagerService when the
      enabled trust agents change. This addition enables TrustListeners to
      react when an authentication method has been enabled by the user.
      
      Test: atest KeyguardStateControllerTest#testOnEnabledTrustAgentsChangedCallback
      Test: atest KeyguardUpdateMonitorTest#testOnEnabledTrustAgentsChangedCallback
      Test: atest TrustManagerServiceTest#reportEnabledTrustAgentsChangedInformsListener
      Fixes: 277845892
      Fixes: 279231562
      Change-Id: Id6d4b65abb4de77f52f1d48499eed3ca26384663
      (cherry picked from commit 3580317c)
      Fixes: 299529171
      Merged-In: Id6d4b65abb4de77f52f1d48499eed3ca26384663
      c3522c19
  7. Aug 22, 2023
  8. Aug 21, 2023
  9. Aug 09, 2023
    • Colin Cross's avatar
      Fix kotlin nullable errors in frameworks/base · 45b07a2d
      Colin Cross authored
      Fix kotlin nullable errors that were exposed by setting the retention
      of android.annotation.NonNull and android.annotation.Nullable to
      class retention.
      
      Bug: 294110802
      Test: builds
      Change-Id: I0736e8abf503c80b92e3762bed908400ffedb335
      45b07a2d
  10. Jul 28, 2023
  11. Jul 19, 2023
  12. Jul 12, 2023
  13. Jul 11, 2023
  14. Jun 30, 2023
    • Victor Hsieh's avatar
      Deduplicate test expectation data in a different way · f3d38d3d
      Victor Hsieh authored
      The test collects expected APEX package names from listing /apex by a
      shell command. The shell command also tries to remove the noise
      (normally an APEX has two entires, see below).
      
      $ ls -d /apex/*/
        /apex/com.android.adbd/
        /apex/com.android.adbd@340815002/
        ...
        /apex/com.google.mainline.primary.libs@340716000/
        /apex/sharedlibs/
      
      The test used to deduplicate by filtering out '@'. But apparently an
      (DLCA) APEX only has one entry with '@'.
      
      With this change, the shell command removes '@\d+' then deduplicate the
      strings.
      
      Bug: 288551133
      Test: BinaryTransparencyHostTest#testCollectAllApexInfo
      (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5a1d0cc3454094a930978bcac1281aafc71475d3)
      Merged-In: I4bc3e8226dd7790aa276ac5dfad7371c60046384
      Change-Id: I4bc3e8226dd7790aa276ac5dfad7371c60046384
      f3d38d3d
  15. Jun 16, 2023
    • Yan Yan's avatar
      VCN: Explicitly handle IAE from updating underlying network · 947aaa4a
      Yan Yan authored
      IpSecTunnelInterface#setUnderlyingNetwork will throw IAE when the
      underlying network is not functional and has null LinkProperties.
      This commit updates VCN to explicitly handle this exception, instead
      relying on the mechanism for handling all uncaught exceptions.
      
      Bug: 240112879
      Test: atest CtsVcnTestCases & FrameworksVcnTests
      Change-Id: I2fdf1da542eb04d56a04e04c762f8c2c19828071
      947aaa4a
    • Alan Stokes's avatar
      Revert "Capture event log" · 5f907d0d
      Alan Stokes authored
      This reverts commit 2f8ca4af.
      
      Reason for revert: This doesn't actually do what I thought it did. And b/286514492 has a more general fix.
      Bug: 239817928
      
      Change-Id: Iffaaf3d9aacc8bd42afb2756517eb91690e8ffe3
      5f907d0d
  16. Jun 15, 2023
  17. Jun 14, 2023
    • Ming-Shin Lu's avatar
      Use INJECT_EVENTS permission for UiBench tests · 8a65461a
      Ming-Shin Lu authored
      Ensure UiBenchActivityTransitionsAnimationMicrobenchmark launching
      EditTextTypeActivity that calls sendKeyDownUpSync is allowed without
      throwing SecurityException.
      
      Bug: 241190603
      Test: atest UiBenchEditTextTypingMicrobenchmark
      Change-Id: Id3c3490d7ab98a17da4e07d8d62d048c98ff1ec4
      8a65461a
  18. Jun 12, 2023
    • Yan Yan's avatar
      Reland: Add attribution tags for VCN and VPN · eb0a9b58
      Yan Yan authored
      Allows IKE library metrics to identify and log the system clients
      
      This commit also updates VcnManagementServiceTest to mock
      out createAttributionContext
      
      Bug: 278943609
      Test: manually verified the metrics
      Test: CtsVcnTestCases, FrameworksVcnTests, Ikev2VpnTest,
            VpnManagerServiceTest, VpnTest
      Change-Id: I8b326de0484f9c97eb1b12f27a792c5ebf35ba1e
      Merged-In: I8b326de0484f9c97eb1b12f27a792c5ebf35ba1e
      eb0a9b58
  19. Jun 09, 2023
    • Yan Yan's avatar
      Reland: Add attribution tags for VCN and VPN · 310ac5b1
      Yan Yan authored
      Allows IKE library metrics to identify and log the system clients
      
      This commit also updates VcnManagementServiceTest to mock
      out createAttributionContext
      
      Bug: 278943609
      Test: manually verified the metrics
      Test: CtsVcnTestCases, FrameworksVcnTests, Ikev2VpnTest,
            VpnManagerServiceTest, VpnTest
      Change-Id: I8b326de0484f9c97eb1b12f27a792c5ebf35ba1e
      310ac5b1
  20. Jun 08, 2023
    • John Reck's avatar
      Transform & preserve gainmaps · b1c20eea
      John Reck authored
      Have Bitmap.createBitmap(sourceBitmap, ...) preserve any gainmaps if
      present, transforming the gainmaps in the same way.
      
      This addresses 2 common usages:
      
      1) Rotating bitmaps to handle EXIF orientations
      2) Bitmap.createScaledBitmap() to do "static" scaling
      
      Bug: 286131154
      Test: SilkFX GainmapTransformsTest
      Change-Id: I5a62dccbb2c70bc38cca581b161eef792c8b2a78
      b1c20eea
  21. Jun 07, 2023
    • Alan Stokes's avatar
      Capture event log · 2f8ca4af
      Alan Stokes authored
      This test, and the code it is testing, makes use of the event log -
      looking for specific info in it, and writing to it.
      
      Make sure we capture the event log during runs of the test so that we
      have some chance of diagnosing falures.
      
      Bug: 239817928
      Test: N/A
      Change-Id: I610c7ddd67381d04c35fd42343e21098c150beb5
      2f8ca4af
  22. Jun 03, 2023
    • czq's avatar
      Disable deprecated abi warning window for InputMethodStressTest · 48ac6e99
      czq authored
      New alert window was added to warn when 32-bit apps are launched on 64-bit devices. However, that interrupts some UI tests when they were launched in `module-abi: x86` or `module-abi: armeabi-v7a` mode. Add the command to disable the warning dialog for these tests.
      
      Bug: 284559054
      Test: atest
      Change-Id: I1a8ecce60d95e27b00f45231f13c6aa80d1cf0bc
      48ac6e99
  23. May 31, 2023
    • Yohei Yukawa's avatar
      Drop InputMethodStressTest from vts · 668de0cd
      Yohei Yukawa authored
      InputMethodStressTest is yet for internal stability testing only.  Not
      ready for formal compatibility tests such as vts.
      
      Fix: 284542566
      Fix: 284950559
      Test: atest InputMethodStressTest
      Change-Id: I5792b0d84b049f8a590cb1146a27882c7084129f
      668de0cd
  24. May 27, 2023
    • czq's avatar
      Fix rotation test on tablets · bd47b2e0
      czq authored
      Although we set "android:configChanges="orientation|screenSize" for TestActivity, it is still recreated after rotation on tablets. After recreation, the old activity and EditText view are dropped, which causes the test failures. Fix this by:
      1. Remove android:configChanges to trigger recreation at all devices
      2. Record the last created instance of TestActivity to get the new activity
      3. Verify the show/hide behavior for the new acitivity. Note that the keyboard will not show after activity recreation only when visibility flag is SOFT_INPUT_STATE_ALWAYS_HIDDEN.
      
      Bug: 275666243
      Test: atest com.android.inputmethod.stresstest.ImeOpenCloseStressTest#testRotateScreenWithKeyboardOn
      Change-Id: I113c0b1376febed5cb6dace9cd0467339f77c699
      bd47b2e0
  25. May 26, 2023
    • Pablo Gamito's avatar
      Keep off displays in trace · 2063d127
      Pablo Gamito authored
      So we can still reference and use the off display.
      Required for FaaS scenario extraction to determine device orientation even if the display is off.
      
      Bug: 281084744
      Test: atest FlickerLibTest && atest FlickerTests
      Change-Id: I027d5505bfc5d615a4e16c611f2cdef3c5aaa508
      2063d127
  26. May 24, 2023
    • Hui Kang's avatar
      [2/7]Add PlatinumTest annotation to tests · 281a0c19
      Hui Kang authored
      These tests already have IwTest annotation. The IwTest tests will be merged with platinum tests using the PlatinumTest annotation. The IwTest annotation will be deprecated and removed.
      
      Test: make
      Bug: 283409062
      Change-Id: Id1554220acc23bc181bbb68105f6e863422f5e8f
      281a0c19
  27. May 22, 2023
    • Sam Dubey's avatar
      Migrate Test mapping · bd2c3587
      Sam Dubey authored
      Postsubmit-only test groups don't need to be in a specific directory.
      
      Bug: 283262732
      Test: N/A
      Change-Id: Ie329253c93f95d19a66c40399f4f72704b20fd84
      bd2c3587
    • czq's avatar
      Remove check for result of IMM#showSoftInput and hideSoftInput · 4d334cc8
      czq authored
      Bug: 280141638
      Test: atest com.android.inputmethod.stresstest.DefaultImeVisibilityTest#showHideDefaultIme
      Change-Id: I5c4e1ea528fdefb676f0db7943098778686624de
      4d334cc8
Loading