[Safer intents] Credentials
To avoid implicit intents, make intents launch explicitly. Bug: 323061508 Test: build Change-Id: I236b6214e761574c82a81b4a7e068f617eae5e9d
This commit is contained in:
@@ -117,6 +117,7 @@ public class MonitoringCertInfoActivity extends Activity implements OnClickListe
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(android.provider.Settings.ACTION_TRUSTED_CREDENTIALS_USER);
|
||||
intent.setPackage(getPackageName());
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
intent.putExtra(TrustedCredentialsSettings.ARG_SHOW_NEW_FOR_USER, mUserId);
|
||||
startActivity(intent);
|
||||
|
@@ -139,6 +139,7 @@ public final class CredentialStorage extends FragmentActivity {
|
||||
}
|
||||
|
||||
final Intent installIntent = new Intent(ACTION_INSTALL)
|
||||
.setPackage(getPackageName())
|
||||
.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT)
|
||||
.putExtras(bundle);
|
||||
startActivityAsUser(installIntent, new UserHandle(dstUserId));
|
||||
|
@@ -41,6 +41,8 @@ import com.google.android.setupdesign.util.ThemeHelper;
|
||||
*/
|
||||
public class InstallCaCertificateWarning extends Activity {
|
||||
|
||||
private static final String CERT_INSTALLER_PACKAGE_NAME = "com.android.certinstaller";
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -79,6 +81,7 @@ public class InstallCaCertificateWarning extends Activity {
|
||||
return v -> {
|
||||
final Intent intent = new Intent();
|
||||
intent.setAction(Credentials.INSTALL_ACTION);
|
||||
intent.setPackage(CERT_INSTALLER_PACKAGE_NAME);
|
||||
intent.putExtra(Credentials.EXTRA_CERTIFICATE_USAGE, Credentials.CERTIFICATE_USAGE_CA);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
Reference in New Issue
Block a user