Merge "Provide API to access Intent that triggered StrictMode violation" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f47f057530
@@ -31881,6 +31881,8 @@ package android.os.strictmode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final class UnsafeIntentLaunchViolation extends android.os.strictmode.Violation {
|
public final class UnsafeIntentLaunchViolation extends android.os.strictmode.Violation {
|
||||||
|
ctor public UnsafeIntentLaunchViolation(@NonNull android.content.Intent);
|
||||||
|
method @Nullable public android.content.Intent getIntent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class UntaggedSocketViolation extends android.os.strictmode.Violation {
|
public final class UntaggedSocketViolation extends android.os.strictmode.Violation {
|
||||||
|
|||||||
@@ -17,10 +17,13 @@
|
|||||||
package android.os.strictmode;
|
package android.os.strictmode;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Violation raised when your app launches an {@link Intent} which originated
|
* Violation raised when your app launches an {@link Intent} which originated
|
||||||
* from outside your app.
|
* from outside your app.
|
||||||
@@ -46,8 +49,20 @@ import android.net.Uri;
|
|||||||
* not protected, your app is likely vulnerable to malicious apps.
|
* not protected, your app is likely vulnerable to malicious apps.
|
||||||
*/
|
*/
|
||||||
public final class UnsafeIntentLaunchViolation extends Violation {
|
public final class UnsafeIntentLaunchViolation extends Violation {
|
||||||
/** @hide */
|
private transient Intent mIntent;
|
||||||
|
|
||||||
public UnsafeIntentLaunchViolation(@NonNull Intent intent) {
|
public UnsafeIntentLaunchViolation(@NonNull Intent intent) {
|
||||||
super("Launch of unsafe intent: " + intent);
|
super("Launch of unsafe intent: " + intent);
|
||||||
|
mIntent = Objects.requireNonNull(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the {@link Intent} which caused this violation to be raised. Note
|
||||||
|
* that this value is not available if this violation has been serialized
|
||||||
|
* since intents cannot be serialized.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("IntentBuilderName")
|
||||||
|
public @Nullable Intent getIntent() {
|
||||||
|
return mIntent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user