Skip to content

Commit d8d6afd

Browse files
Selim GurunAndroid (Google) Code Review
authored andcommitted
Merge "Revert "Act on credential storage updates.""
2 parents 8963822 + 43e4158 commit d8d6afd

File tree

4 files changed

+2
-80
lines changed

4 files changed

+2
-80
lines changed

core/java/android/net/http/CertificateChainValidator.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@
2525
import javax.net.ssl.SSLHandshakeException;
2626
import javax.net.ssl.SSLSession;
2727
import javax.net.ssl.SSLSocket;
28-
import javax.net.ssl.X509TrustManager;
2928
import org.apache.harmony.security.provider.cert.X509CertImpl;
3029
import org.apache.harmony.xnet.provider.jsse.SSLParametersImpl;
31-
import org.apache.harmony.xnet.provider.jsse.TrustManagerImpl;
3230

3331
/**
3432
* Class responsible for all server certificate validation functionality
3533
*
3634
* {@hide}
3735
*/
38-
public class CertificateChainValidator {
36+
class CertificateChainValidator {
3937

4038
/**
4139
* The singleton instance of the certificate chain validator
@@ -123,18 +121,6 @@ public static SslError verifyServerCertificates(
123121
return verifyServerDomainAndCertificates(serverCertificates, domain, authType);
124122
}
125123

126-
/**
127-
* Handles updates to credential storage.
128-
*/
129-
public static void handleTrustStorageUpdate() {
130-
131-
X509TrustManager x509TrustManager = SSLParametersImpl.getDefaultTrustManager();
132-
if( x509TrustManager instanceof TrustManagerImpl ) {
133-
TrustManagerImpl trustManager = (TrustManagerImpl) x509TrustManager;
134-
trustManager.handleTrustStorageUpdate();
135-
}
136-
}
137-
138124
/**
139125
* Common code of doHandshakeAndValidateServerCertificates and verifyServerCertificates.
140126
* Calls DomainNamevalidator to verify the domain, and TrustManager to verify the certs.

core/java/android/webkit/WebView.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
import android.os.StrictMode;
6060
import android.os.SystemClock;
6161
import android.provider.Settings;
62-
import android.security.KeyChain;
6362
import android.speech.tts.TextToSpeech;
6463
import android.text.Editable;
6564
import android.text.InputType;
@@ -1304,7 +1303,6 @@ protected WebView(Context context, AttributeSet attrs, int defStyle,
13041303
init();
13051304
setupPackageListener(context);
13061305
setupProxyListener(context);
1307-
setupTrustStorageListener(context);
13081306
updateMultiTouchSupport(context);
13091307

13101308
if (privateBrowsing) {
@@ -1314,41 +1312,6 @@ protected WebView(Context context, AttributeSet attrs, int defStyle,
13141312
mAutoFillData = new WebViewCore.AutoFillData();
13151313
}
13161314

1317-
private static class TrustStorageListener extends BroadcastReceiver {
1318-
@Override
1319-
public void onReceive(Context context, Intent intent) {
1320-
if (intent.getAction().equals(KeyChain.ACTION_STORAGE_CHANGED)) {
1321-
handleCertTrustChanged();
1322-
}
1323-
}
1324-
}
1325-
private static TrustStorageListener sTrustStorageListener;
1326-
1327-
/**
1328-
* Handles update to the trust storage.
1329-
*/
1330-
private static void handleCertTrustChanged() {
1331-
// send a message for indicating trust storage change
1332-
WebViewCore.sendStaticMessage(EventHub.TRUST_STORAGE_UPDATED, null);
1333-
}
1334-
1335-
/*
1336-
* @param context This method expects this to be a valid context.
1337-
*/
1338-
private static void setupTrustStorageListener(Context context) {
1339-
if (sTrustStorageListener != null ) {
1340-
return;
1341-
}
1342-
IntentFilter filter = new IntentFilter();
1343-
filter.addAction(KeyChain.ACTION_STORAGE_CHANGED);
1344-
sTrustStorageListener = new TrustStorageListener();
1345-
Intent current =
1346-
context.getApplicationContext().registerReceiver(sTrustStorageListener, filter);
1347-
if (current != null) {
1348-
handleCertTrustChanged();
1349-
}
1350-
}
1351-
13521315
private static class ProxyReceiver extends BroadcastReceiver {
13531316
@Override
13541317
public void onReceive(Context context, Intent intent) {

core/java/android/webkit/WebViewCore.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import android.media.MediaFile;
2727
import android.net.ProxyProperties;
2828
import android.net.Uri;
29-
import android.net.http.CertificateChainValidator;
3029
import android.os.Bundle;
3130
import android.os.Handler;
3231
import android.os.Looper;
@@ -776,11 +775,6 @@ public void handleMessage(Message msg) {
776775
Message m = (Message)msg.obj;
777776
m.sendToTarget();
778777
break;
779-
case EventHub.TRUST_STORAGE_UPDATED:
780-
// post a task to network thread for updating trust manager
781-
nativeCertTrustChanged();
782-
CertificateChainValidator.handleTrustStorageUpdate();
783-
break;
784778
}
785779
}
786780
};
@@ -1139,9 +1133,6 @@ public class EventHub {
11391133
static final int SELECT_WORD_AT = 214;
11401134
static final int SELECT_ALL = 215;
11411135

1142-
// for updating state on trust storage change
1143-
static final int TRUST_STORAGE_UPDATED = 220;
1144-
11451136
// Private handler for WebCore messages.
11461137
private Handler mHandler;
11471138
// Message queue for containing messages before the WebCore thread is
@@ -3091,6 +3082,4 @@ private native void nativeSelectText(int nativeClass,
30913082
private native void nativeClearTextSelection(int nativeClass);
30923083
private native void nativeSelectWordAt(int nativeClass, int x, int y);
30933084
private native void nativeSelectAll(int nativeClass);
3094-
3095-
private static native void nativeCertTrustChanged();
30963085
}

keystore/java/android/security/KeyChain.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public final class KeyChain {
124124
public static final String EXTRA_SENDER = "sender";
125125

126126
/**
127-
* Action to bring up the CertInstaller.
127+
* Action to bring up the CertInstaller
128128
*/
129129
private static final String ACTION_INSTALL = "android.credentials.INSTALL";
130130

@@ -167,22 +167,6 @@ public final class KeyChain {
167167
// Compatible with old android.security.Credentials.PKCS12
168168
public static final String EXTRA_PKCS12 = "PKCS12";
169169

170-
171-
/**
172-
* @hide TODO This is temporary and will be removed
173-
* Broadcast Action: Indicates the trusted storage has changed. Sent when
174-
* one of this happens:
175-
*
176-
* <ul>
177-
* <li>a new CA is added,
178-
* <li>an existing CA is removed or disabled,
179-
* <li>a disabled CA is enabled,
180-
* <li>trusted storage is reset (all user certs are cleared),
181-
* <li>when permission to access a private key is changed.
182-
* </ul>
183-
*/
184-
public static final String ACTION_STORAGE_CHANGED = "android.security.STORAGE_CHANGED";
185-
186170
/**
187171
* Returns an {@code Intent} that can be used for credential
188172
* installation. The intent may be used without any extras, in

0 commit comments

Comments
 (0)