Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc429782 authored by Charles Chen's avatar Charles Chen
Browse files

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
parent c8d8b7cd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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();
  }
+7 −6
Original line number Diff line number Diff line
@@ -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);
    }