Unhide isUiContext()
... because it is more tied to Context instance that developers are working with. Bug: 179308116 Test: atest ContextIsUiContextTest Change-Id: I41d90c4b5b81b430fc8007a0bdf86c6fd1c54400
This commit is contained in:
@@ -10356,7 +10356,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[]);
|
||||
@@ -18813,6 +18813,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();
|
||||
|
||||
@@ -6662,15 +6662,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
|
||||
@@ -6683,12 +6674,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.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user