1

My compileSdk is 33.

If I open /AndroidSdk/sources/android-33 in file manager, then I can locate android.security.net.config.NetworkSecurityTrustManager. It resides in /AndroidSdk/sources/android-33/android/security/net/config.

However, if I unpack /AndroidSdk/platforms/android-33/android.jar into /unpacked, then within /unpacked I cannot find android.security.net.config.NetworkSecurityTrustManager (I expect it at /unpacked/android/security/net/config).

It seems that NetworkSecurityTrustManager exists in sources, but does not exist in android.jar. Why is that?

Eugene Chumak
  • 3,272
  • 7
  • 34
  • 52

1 Answers1

1

If you look at the source code, you will see that it is marked with the @hide annotation:

/**
 * {@link X509ExtendedTrustManager} that implements the trust anchor and pinning for a
 * given {@link NetworkSecurityConfig}.
 * @hide
 */
public class NetworkSecurityTrustManager extends X509ExtendedTrustManager {

Classes marked with that annotation are not necessarily included in android.jar, because they are not part of the Android SDK.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thank you for the answer! By the way, NetworkSecurityTrustManager has the following field: private final TrustManagerImpl mDelegate. This TrustManagerImpl, in turn, does not present in sources. Why is that? Why NetworkSecurityTrustManager is not part of sdk, but is present in sources, but TrustManagerImpl is also not part of sdk (I guess), but is not present in sources? – Eugene Chumak Mar 21 '23 at 10:51
  • @EugeneChumak: "This TrustManagerImpl, in turn, does not present in sources" -- that depends on [where you look](https://cs.android.com/android/platform/superproject/+/master:external/conscrypt/common/src/main/java/org/conscrypt/TrustManagerImpl.java;l=86?q=TrustManagerImpl&sq=). – CommonsWare Mar 21 '23 at 10:57
  • @EugeneChumak: I do not know what their rules are for what is and is not included in the sources supplied via the SDK. I have not used those much in recent years, preferring instead to get them elsewhere. In particular, https://cs.android.com/ has been very useful for finding stuff like this. – CommonsWare Mar 21 '23 at 11:06