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

Commit f2259211 authored by Charles Chen's avatar Charles Chen Committed by Android (Google) Code Review
Browse files

Merge "Unhide isUiContext()" into sc-dev

parents 0dae8f70 aa6de2e6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -10389,7 +10389,7 @@ package android.content {
    method public abstract void grantUriPermission(String, android.net.Uri, int);
    method public abstract boolean isDeviceProtectedStorage();
    method public boolean isRestricted();
    method public static boolean isUiContext(@NonNull android.content.Context);
    method public boolean isUiContext();
    method public abstract boolean moveDatabaseFrom(android.content.Context, String);
    method public abstract boolean moveSharedPreferencesFrom(android.content.Context, String);
    method @NonNull public final android.content.res.TypedArray obtainStyledAttributes(@NonNull @StyleableRes int[]);
@@ -18896,6 +18896,7 @@ package android.inputmethodservice {
  public abstract class AbstractInputMethodService extends android.app.Service implements android.view.KeyEvent.Callback {
    ctor public AbstractInputMethodService();
    method public android.view.KeyEvent.DispatcherState getKeyDispatcherState();
    method public final boolean isUiContext();
    method public final android.os.IBinder onBind(android.content.Intent);
    method public abstract android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface();
    method public abstract android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface();
+6 −11
Original line number Diff line number Diff line
@@ -6673,15 +6673,6 @@ public abstract class Context {
        }
    }

    /**
     * Indicates if this context is a visual context such as {@link android.app.Activity} or
     * a context created from {@link #createWindowContext(int, Bundle)}.
     * @hide
     */
    public boolean isUiContext() {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

    /**
     * Returns {@code true} if the context is a UI context which can access UI components such as
     * {@link WindowManager}, {@link android.view.LayoutInflater LayoutInflater} or
@@ -6694,12 +6685,16 @@ public abstract class Context {
     * {@link #createWindowContext(int, Bundle)} or
     * {@link android.inputmethodservice.InputMethodService InputMethodService}
     * </p>
     * <p>
     * Note that even if it is allowed programmatically, it is not suggested to override this
     * method to bypass {@link android.os.strictmode.IncorrectContextUseViolation} verification.
     * </p>
     *
     * @see #getDisplay()
     * @see #getSystemService(String)
     * @see android.os.StrictMode.VmPolicy.Builder#detectIncorrectContextUse()
     */
    public static boolean isUiContext(@NonNull Context context) {
        return context.isUiContext();
    public boolean isUiContext() {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import android.content.Context;
 * instance.
 *
 * @see Context#getSystemService(String)
 * @see Context#isUiContext(Context)
 * @see Context#isUiContext
 * @see android.os.StrictMode.VmPolicy.Builder#detectIncorrectContextUse()
 */
public final class IncorrectContextUseViolation extends Violation {