am 835e0cb7: am cf008c28: Do not allow non-primary user to install certs

* commit '835e0cb7087f049d25b08b820088a5c40bc0932f':
  Do not allow non-primary user to install certs
This commit is contained in:
Kenny Root
2012-09-17 14:44:43 -07:00
committed by Android Git Automerger

View File

@@ -25,6 +25,7 @@ import android.content.res.Resources;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.UserHandle;
import android.security.Credentials; import android.security.Credentials;
import android.security.KeyChain.KeyChainConnection; import android.security.KeyChain.KeyChainConnection;
import android.security.KeyChain; import android.security.KeyChain;
@@ -104,17 +105,24 @@ public final class CredentialStorage extends Activity {
*/ */
private int mRetriesRemaining = -1; private int mRetriesRemaining = -1;
@Override protected void onResume() { @Override
protected void onResume() {
super.onResume(); super.onResume();
if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
Log.i(TAG, "Cannot install to CredentialStorage as non-primary user");
finish();
return;
}
Intent intent = getIntent(); Intent intent = getIntent();
String action = intent.getAction(); String action = intent.getAction();
if (ACTION_RESET.equals(action)) { if (ACTION_RESET.equals(action)) {
new ResetDialog(); new ResetDialog();
} else { } else {
if (ACTION_INSTALL.equals(action) && if (ACTION_INSTALL.equals(action)
"com.android.certinstaller".equals(getCallingPackage())) { && "com.android.certinstaller".equals(getCallingPackage())) {
mInstallBundle = intent.getExtras(); mInstallBundle = intent.getExtras();
} }
// ACTION_UNLOCK also handled here in addition to ACTION_INSTALL // ACTION_UNLOCK also handled here in addition to ACTION_INSTALL