The static instances of SystemCertificateSource and
UserCertificateSource depend on the current user, avoid triggering their
static initializer when preloaded.
Bug:
29258379
Change-Id: I5088366ae67145b8bc928d6c04118529c82a7fc3
* @hide
*/
public final class SystemCertificateSource extends DirectoryCertificateSource {
- private static final SystemCertificateSource INSTANCE = new SystemCertificateSource();
+ private static class NoPreloadHolder {
+ private static final SystemCertificateSource INSTANCE = new SystemCertificateSource();
+ }
+
private final File mUserRemovedCaDir;
private SystemCertificateSource() {
}
public static SystemCertificateSource getInstance() {
- return INSTANCE;
+ return NoPreloadHolder.INSTANCE;
}
@Override
* @hide
*/
public final class UserCertificateSource extends DirectoryCertificateSource {
- private static final UserCertificateSource INSTANCE = new UserCertificateSource();
+ private static class NoPreloadHolder {
+ private static final UserCertificateSource INSTANCE = new UserCertificateSource();
+ }
private UserCertificateSource() {
super(new File(
}
public static UserCertificateSource getInstance() {
- return INSTANCE;
+ return NoPreloadHolder.INSTANCE;
}
@Override