Unhide IncorrectContextUseViolation
As a feedback from API review, we should unhide the violation so that the developers can perform instanceof check when writing their own logging stacks. fixes: 177707145 Test: atest StrictModeTest Change-Id: I6fbf10c915b5b6a7c72aacc5882ef5e33551c6e8
This commit is contained in:
@@ -31849,6 +31849,10 @@ package android.os.strictmode {
|
||||
public final class ImplicitDirectBootViolation extends android.os.strictmode.Violation {
|
||||
}
|
||||
|
||||
public final class IncorrectContextUseViolation extends android.os.strictmode.Violation {
|
||||
ctor public IncorrectContextUseViolation(@NonNull String, @NonNull Throwable);
|
||||
}
|
||||
|
||||
public class InstanceCountViolation extends android.os.strictmode.Violation {
|
||||
method public long getNumberOfInstances();
|
||||
}
|
||||
|
||||
@@ -16,19 +16,20 @@
|
||||
|
||||
package android.os.strictmode;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* Incorrect usage of {@link Context}, such as obtaining a visual service from non-visual
|
||||
* {@link Context} instance.
|
||||
* Incorrect usage of {@link Context}, such as obtaining a UI service from non-UI {@link Context}
|
||||
* instance.
|
||||
*
|
||||
* @see Context#getSystemService(String)
|
||||
* @see Context#getDisplayNoVerify()
|
||||
* @hide
|
||||
* @see Context#isUiContext(Context)
|
||||
* @see android.os.StrictMode.VmPolicy.Builder#detectIncorrectContextUse()
|
||||
*/
|
||||
public final class IncorrectContextUseViolation extends Violation {
|
||||
|
||||
/** @hide */
|
||||
public IncorrectContextUseViolation(String message, Throwable originStack) {
|
||||
public IncorrectContextUseViolation(@NonNull String message, @NonNull Throwable originStack) {
|
||||
super(message);
|
||||
initCause(originStack);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user