diff options
| author | Charles Chen <charlesccchen@google.com> | 2021-04-09 06:56:16 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-04-09 06:56:16 +0000 |
| commit | c22aff4e4d4de8fcb95e1544db952aa1bdfd999a (patch) | |
| tree | 8cf9b6f59d3ea3877d863f220ea57df84a598a27 /core/java/android/content | |
| parent | 0584a987a47fbca8ca8c76bd579f81ad19c693da (diff) | |
| parent | d12be75275d2b4e244e72c4382720b76a53d1084 (diff) | |
Merge "Allow config context to inflate views" into sc-dev
Diffstat (limited to 'core/java/android/content')
| -rw-r--r-- | core/java/android/content/Context.java | 21 | ||||
| -rw-r--r-- | core/java/android/content/ContextWrapper.java | 11 |
2 files changed, 32 insertions, 0 deletions
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 36769825c439..5fd85613c7ef 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -6817,4 +6817,25 @@ public abstract class Context { * @hide */ public void destroy() { } + + /** + * Indicates this {@link Context} has the proper {@link Configuration} to obtain + * {@link android.view.LayoutInflater}, {@link android.view.ViewConfiguration} and + * {@link android.view.GestureDetector}. Generally, all UI contexts, such as + * {@link android.app.Activity} or {@link android.app.WindowContext}, are initialized with base + * configuration. + * <p> + * Note that the context created via {@link Context#createConfigurationContext(Configuration)} + * is also regarded as a context that is based on a configuration because the + * configuration is explicitly provided via the API. + * </p> + * + * @see #isUiContext() + * @see #createConfigurationContext(Configuration) + * + * @hide + */ + public boolean isConfigurationContext() { + throw new RuntimeException("Not implemented. Must override in a subclass."); + } } diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java index de0d65fec1fb..8936d0c47a58 100644 --- a/core/java/android/content/ContextWrapper.java +++ b/core/java/android/content/ContextWrapper.java @@ -1250,4 +1250,15 @@ public class ContextWrapper extends Context { } return mBase.isUiContext(); } + + /** + * @hide + */ + @Override + public boolean isConfigurationContext() { + if (mBase == null) { + return false; + } + return mBase.isConfigurationContext(); + } } |
