Loading apex/Android.bp +1 −3 Original line number Diff line number Diff line Loading @@ -94,10 +94,8 @@ java_defaults { annotations_enabled: true, // The stub libraries must be visible to frameworks/base so they can be combined // into API specific libraries. stubs_library_visibility: [ "//frameworks/base", // Framework "//visibility:public", ], // Set the visibility of the modules creating the stubs source. Loading apex/media/framework/java/android/media/MediaSession2.java +1 −1 Original line number Diff line number Diff line Loading @@ -404,7 +404,7 @@ public class MediaSession2 implements AutoCloseable { mCallback.onPostConnect(MediaSession2.this, controllerInfo); connected = true; } finally { if (!connected) { if (!connected || isClosed()) { if (DEBUG) { Log.d(TAG, "Rejecting connection or notifying that session is closed" + ", controllerInfo=" + controllerInfo); Loading core/java/android/app/ContextImpl.java +5 −2 Original line number Diff line number Diff line Loading @@ -1900,11 +1900,13 @@ class ContextImpl extends Context { @Override public Object getSystemService(String name) { // We may override this API from outer context. final boolean isUiContext = isUiContext() || getOuterContext().isUiContext(); // Check incorrect Context usage. if (isUiComponent(name) && !isUiContext() && vmIncorrectContextUseEnabled()) { if (isUiComponent(name) && !isUiContext && vmIncorrectContextUseEnabled()) { final String errorMessage = "Tried to access visual service " + SystemServiceRegistry.getSystemServiceClassName(name) + " from a non-visual Context. "; + " from a non-visual Context:" + getOuterContext(); final String message = "Visual services, such as WindowManager, WallpaperService or " + "LayoutInflater should be accessed from Activity or other visual Context. " + "Use an Activity or a Context created with " Loading Loading @@ -2369,6 +2371,7 @@ class ContextImpl extends Context { context.setResources(createResources(mToken, mPackageInfo, mSplitName, displayId, overrideConfiguration, getDisplayAdjustments(displayId).getCompatibilityInfo(), mResources.getLoaders())); context.mIsUiContext = isUiContext() || getOuterContext().isUiContext(); return context; } Loading core/java/android/view/ViewConfiguration.java +3 −2 Original line number Diff line number Diff line Loading @@ -500,12 +500,13 @@ public class ViewConfiguration { */ public static ViewConfiguration get(Context context) { if (!context.isUiContext() && vmIncorrectContextUseEnabled()) { final String errorMessage = "Tried to access UI constants from a non-visual Context."; final String errorMessage = "Tried to access UI constants from a non-visual Context:" + context; final String message = "UI constants, such as display metrics or window metrics, " + "must be accessed from Activity or other visual Context. " + "Use an Activity or a Context created with " + "Context#createWindowContext(int, Bundle), which are adjusted to the " + "configuration and visual bounds of an area on screen."; + "configuration and visual bounds of an area on screen"; final Exception exception = new IllegalArgumentException(errorMessage); StrictMode.onIncorrectContextUsed(message, exception); Log.e(TAG, errorMessage + message, exception); Loading core/java/android/view/WindowManager.java +19 −9 Original line number Diff line number Diff line Loading @@ -1454,11 +1454,22 @@ public interface WindowManager extends ViewManager { @Deprecated public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000; /** Window flag: When set, input method can't interact with the focusable window * and can be placed to use more space and cover the input method. * Note: When combined with {@link #FLAG_NOT_FOCUSABLE}, this flag has no * effect since input method cannot interact with windows having {@link #FLAG_NOT_FOCUSABLE} * flag set. /** Window flag: when set, inverts the input method focusability of the window. * * The effect of setting this flag depends on whether {@link #FLAG_NOT_FOCUSABLE} is set: * <p> * If {@link #FLAG_NOT_FOCUSABLE} is <em>not</em> set, i.e. when the window is focusable, * setting this flag prevents this window from becoming the target of the input method. * Consequently, it will <em>not</em> be able to interact with the input method, * and will be layered above the input method (unless there is another input method * target above it). * * <p> * If {@link #FLAG_NOT_FOCUSABLE} <em>is</em> set, setting this flag requests for the window * to be the input method target even though the window is <em>not</em> focusable. * Consequently, it will be layered below the input method. * Note: Windows that set {@link #FLAG_NOT_FOCUSABLE} cannot interact with the input method, * regardless of this flag. */ public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000; Loading Loading @@ -2142,13 +2153,12 @@ public interface WindowManager extends ViewManager { * focus. In particular, this checks the * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM} * flags and returns true if the combination of the two corresponds * to a window that needs to be behind the input method so that the * user can type into it. * to a window that can use the input method. * * @param flags The current window manager flags. * * @return Returns {@code true} if such a window should be behind/interact * with an input method, {@code false} if not. * @return Returns {@code true} if a window with the given flags would be able to * use the input method, {@code false} if not. */ public static boolean mayUseInputMethod(int flags) { return (flags & FLAG_NOT_FOCUSABLE) != FLAG_NOT_FOCUSABLE Loading Loading
apex/Android.bp +1 −3 Original line number Diff line number Diff line Loading @@ -94,10 +94,8 @@ java_defaults { annotations_enabled: true, // The stub libraries must be visible to frameworks/base so they can be combined // into API specific libraries. stubs_library_visibility: [ "//frameworks/base", // Framework "//visibility:public", ], // Set the visibility of the modules creating the stubs source. Loading
apex/media/framework/java/android/media/MediaSession2.java +1 −1 Original line number Diff line number Diff line Loading @@ -404,7 +404,7 @@ public class MediaSession2 implements AutoCloseable { mCallback.onPostConnect(MediaSession2.this, controllerInfo); connected = true; } finally { if (!connected) { if (!connected || isClosed()) { if (DEBUG) { Log.d(TAG, "Rejecting connection or notifying that session is closed" + ", controllerInfo=" + controllerInfo); Loading
core/java/android/app/ContextImpl.java +5 −2 Original line number Diff line number Diff line Loading @@ -1900,11 +1900,13 @@ class ContextImpl extends Context { @Override public Object getSystemService(String name) { // We may override this API from outer context. final boolean isUiContext = isUiContext() || getOuterContext().isUiContext(); // Check incorrect Context usage. if (isUiComponent(name) && !isUiContext() && vmIncorrectContextUseEnabled()) { if (isUiComponent(name) && !isUiContext && vmIncorrectContextUseEnabled()) { final String errorMessage = "Tried to access visual service " + SystemServiceRegistry.getSystemServiceClassName(name) + " from a non-visual Context. "; + " from a non-visual Context:" + getOuterContext(); final String message = "Visual services, such as WindowManager, WallpaperService or " + "LayoutInflater should be accessed from Activity or other visual Context. " + "Use an Activity or a Context created with " Loading Loading @@ -2369,6 +2371,7 @@ class ContextImpl extends Context { context.setResources(createResources(mToken, mPackageInfo, mSplitName, displayId, overrideConfiguration, getDisplayAdjustments(displayId).getCompatibilityInfo(), mResources.getLoaders())); context.mIsUiContext = isUiContext() || getOuterContext().isUiContext(); return context; } Loading
core/java/android/view/ViewConfiguration.java +3 −2 Original line number Diff line number Diff line Loading @@ -500,12 +500,13 @@ public class ViewConfiguration { */ public static ViewConfiguration get(Context context) { if (!context.isUiContext() && vmIncorrectContextUseEnabled()) { final String errorMessage = "Tried to access UI constants from a non-visual Context."; final String errorMessage = "Tried to access UI constants from a non-visual Context:" + context; final String message = "UI constants, such as display metrics or window metrics, " + "must be accessed from Activity or other visual Context. " + "Use an Activity or a Context created with " + "Context#createWindowContext(int, Bundle), which are adjusted to the " + "configuration and visual bounds of an area on screen."; + "configuration and visual bounds of an area on screen"; final Exception exception = new IllegalArgumentException(errorMessage); StrictMode.onIncorrectContextUsed(message, exception); Log.e(TAG, errorMessage + message, exception); Loading
core/java/android/view/WindowManager.java +19 −9 Original line number Diff line number Diff line Loading @@ -1454,11 +1454,22 @@ public interface WindowManager extends ViewManager { @Deprecated public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000; /** Window flag: When set, input method can't interact with the focusable window * and can be placed to use more space and cover the input method. * Note: When combined with {@link #FLAG_NOT_FOCUSABLE}, this flag has no * effect since input method cannot interact with windows having {@link #FLAG_NOT_FOCUSABLE} * flag set. /** Window flag: when set, inverts the input method focusability of the window. * * The effect of setting this flag depends on whether {@link #FLAG_NOT_FOCUSABLE} is set: * <p> * If {@link #FLAG_NOT_FOCUSABLE} is <em>not</em> set, i.e. when the window is focusable, * setting this flag prevents this window from becoming the target of the input method. * Consequently, it will <em>not</em> be able to interact with the input method, * and will be layered above the input method (unless there is another input method * target above it). * * <p> * If {@link #FLAG_NOT_FOCUSABLE} <em>is</em> set, setting this flag requests for the window * to be the input method target even though the window is <em>not</em> focusable. * Consequently, it will be layered below the input method. * Note: Windows that set {@link #FLAG_NOT_FOCUSABLE} cannot interact with the input method, * regardless of this flag. */ public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000; Loading Loading @@ -2142,13 +2153,12 @@ public interface WindowManager extends ViewManager { * focus. In particular, this checks the * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM} * flags and returns true if the combination of the two corresponds * to a window that needs to be behind the input method so that the * user can type into it. * to a window that can use the input method. * * @param flags The current window manager flags. * * @return Returns {@code true} if such a window should be behind/interact * with an input method, {@code false} if not. * @return Returns {@code true} if a window with the given flags would be able to * use the input method, {@code false} if not. */ public static boolean mayUseInputMethod(int flags) { return (flags & FLAG_NOT_FOCUSABLE) != FLAG_NOT_FOCUSABLE Loading