[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
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
Intent intent = new Intent(android.provider.Settings.ACTION_TRUSTED_CREDENTIALS_USER);
|
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.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
intent.putExtra(TrustedCredentialsSettings.ARG_SHOW_NEW_FOR_USER, mUserId);
|
intent.putExtra(TrustedCredentialsSettings.ARG_SHOW_NEW_FOR_USER, mUserId);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@@ -139,6 +139,7 @@ public final class CredentialStorage extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Intent installIntent = new Intent(ACTION_INSTALL)
|
final Intent installIntent = new Intent(ACTION_INSTALL)
|
||||||
|
.setPackage(getPackageName())
|
||||||
.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT)
|
.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT)
|
||||||
.putExtras(bundle);
|
.putExtras(bundle);
|
||||||
startActivityAsUser(installIntent, new UserHandle(dstUserId));
|
startActivityAsUser(installIntent, new UserHandle(dstUserId));
|
||||||
|
@@ -41,6 +41,8 @@ import com.google.android.setupdesign.util.ThemeHelper;
|
|||||||
*/
|
*/
|
||||||
public class InstallCaCertificateWarning extends Activity {
|
public class InstallCaCertificateWarning extends Activity {
|
||||||
|
|
||||||
|
private static final String CERT_INSTALLER_PACKAGE_NAME = "com.android.certinstaller";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -79,6 +81,7 @@ public class InstallCaCertificateWarning extends Activity {
|
|||||||
return v -> {
|
return v -> {
|
||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
intent.setAction(Credentials.INSTALL_ACTION);
|
intent.setAction(Credentials.INSTALL_ACTION);
|
||||||
|
intent.setPackage(CERT_INSTALLER_PACKAGE_NAME);
|
||||||
intent.putExtra(Credentials.EXTRA_CERTIFICATE_USAGE, Credentials.CERTIFICATE_USAGE_CA);
|
intent.putExtra(Credentials.EXTRA_CERTIFICATE_USAGE, Credentials.CERTIFICATE_USAGE_CA);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
Reference in New Issue
Block a user