Loading core/java/android/app/Activity.java +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.annotation.RequiresPermission; import android.annotation.StyleRes; import android.annotation.SystemApi; import android.annotation.TestApi; import android.annotation.UiContext; import android.app.VoiceInteractor.Request; import android.app.admin.DevicePolicyManager; import android.app.assist.AssistContent; Loading Loading @@ -726,6 +727,7 @@ import java.util.function.Consumer; * upload, independent of whether the original activity is paused, stopped, * or finished. */ @UiContext public class Activity extends ContextThemeWrapper implements LayoutInflater.Factory2, Window.Callback, KeyEvent.Callback, Loading core/java/android/app/Dialog.java +10 −5 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StringRes; import android.annotation.StyleRes; import android.annotation.UiContext; import android.compat.annotation.UnsupportedAppUsage; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -101,6 +102,7 @@ public class Dialog implements DialogInterface, Window.Callback, private final WindowManager mWindowManager; @UnsupportedAppUsage @UiContext final Context mContext; @UnsupportedAppUsage final Window mWindow; Loading Loading @@ -158,7 +160,7 @@ public class Dialog implements DialogInterface, Window.Callback, * @param context the context in which the dialog should run * @see android.R.styleable#Theme_dialogTheme */ public Dialog(@NonNull Context context) { public Dialog(@UiContext @NonNull Context context) { this(context, 0, true); } Loading @@ -177,11 +179,12 @@ public class Dialog implements DialogInterface, Window.Callback, * @param themeResId a style resource describing the theme to use for the * window, or {@code 0} to use the default dialog theme */ public Dialog(@NonNull Context context, @StyleRes int themeResId) { public Dialog(@UiContext @NonNull Context context, @StyleRes int themeResId) { this(context, themeResId, true); } Dialog(@NonNull Context context, @StyleRes int themeResId, boolean createContextThemeWrapper) { Dialog(@UiContext @NonNull Context context, @StyleRes int themeResId, boolean createContextThemeWrapper) { if (createContextThemeWrapper) { if (themeResId == Resources.ID_NULL) { final TypedValue outValue = new TypedValue(); Loading Loading @@ -222,7 +225,7 @@ public class Dialog implements DialogInterface, Window.Callback, mCancelMessage = cancelCallback; } protected Dialog(@NonNull Context context, boolean cancelable, protected Dialog(@UiContext @NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) { this(context); mCancelable = cancelable; Loading @@ -234,7 +237,9 @@ public class Dialog implements DialogInterface, Window.Callback, * * @return Context The Context used by the Dialog. */ public final @NonNull Context getContext() { @UiContext @NonNull public final Context getContext() { return mContext; } Loading core/java/android/app/WallpaperManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.annotation.UiContext; import android.compat.annotation.UnsupportedAppUsage; import android.content.ComponentName; import android.content.ContentResolver; Loading Loading @@ -213,7 +214,6 @@ public class WallpaperManager { private static final Object sSync = new Object[0]; @UnsupportedAppUsage private static Globals sGlobals; private final Context mContext; private final boolean mWcgEnabled; private final ColorManagementProxy mCmProxy; Loading Loading @@ -539,7 +539,8 @@ public class WallpaperManager { } } /*package*/ WallpaperManager(IWallpaperManager service, Context context, Handler handler) { /*package*/ WallpaperManager(IWallpaperManager service, @UiContext Context context, Handler handler) { mContext = context; if (service != null) { initGlobals(service, context.getMainLooper()); Loading core/java/android/app/WindowContext.java +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.view.WindowManagerGlobal.ADD_TOO_MANY_TOKENS; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UiContext; import android.content.Context; import android.content.ContextWrapper; import android.os.Bundle; Loading @@ -42,6 +43,7 @@ import java.lang.ref.Reference; * @see Context#createWindowContext(int, Bundle) * @hide */ @UiContext public class WindowContext extends ContextWrapper { private final WindowManagerImpl mWindowManager; private final IWindowManager mWms; Loading core/java/android/content/Context.java +9 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.CallbackExecutor; import android.annotation.CheckResult; import android.annotation.ColorInt; import android.annotation.ColorRes; import android.annotation.DisplayContext; import android.annotation.DrawableRes; import android.annotation.IntDef; import android.annotation.NonNull; Loading @@ -33,6 +34,7 @@ import android.annotation.StyleableRes; import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.TestApi; import android.annotation.UiContext; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.IApplicationThread; Loading Loading @@ -3750,6 +3752,7 @@ public abstract class Context { * @see #getSystemService(String) * @see android.view.WindowManager */ @UiContext public static final String WINDOW_SERVICE = "window"; /** Loading @@ -3760,6 +3763,7 @@ public abstract class Context { * @see #getSystemService(String) * @see android.view.LayoutInflater */ @UiContext public static final String LAYOUT_INFLATER_SERVICE = "layout_inflater"; /** Loading Loading @@ -3932,6 +3936,7 @@ public abstract class Context { * * @see #getSystemService(String) */ @UiContext public static final String WALLPAPER_SERVICE = "wallpaper"; /** Loading Loading @@ -5789,6 +5794,7 @@ public abstract class Context { * * @return A {@link Context} for the display. */ @DisplayContext public abstract Context createDisplayContext(@NonNull Display display); /** Loading Loading @@ -5853,7 +5859,9 @@ public abstract class Context { * the current number of window contexts without adding any view by * {@link WindowManager#addView} <b>exceeds five</b>. */ public @NonNull Context createWindowContext(@WindowType int type, @Nullable Bundle options) { @UiContext @NonNull public Context createWindowContext(@WindowType int type, @Nullable Bundle options) { throw new RuntimeException("Not implemented. Must override in a subclass."); } Loading Loading
core/java/android/app/Activity.java +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.annotation.RequiresPermission; import android.annotation.StyleRes; import android.annotation.SystemApi; import android.annotation.TestApi; import android.annotation.UiContext; import android.app.VoiceInteractor.Request; import android.app.admin.DevicePolicyManager; import android.app.assist.AssistContent; Loading Loading @@ -726,6 +727,7 @@ import java.util.function.Consumer; * upload, independent of whether the original activity is paused, stopped, * or finished. */ @UiContext public class Activity extends ContextThemeWrapper implements LayoutInflater.Factory2, Window.Callback, KeyEvent.Callback, Loading
core/java/android/app/Dialog.java +10 −5 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StringRes; import android.annotation.StyleRes; import android.annotation.UiContext; import android.compat.annotation.UnsupportedAppUsage; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -101,6 +102,7 @@ public class Dialog implements DialogInterface, Window.Callback, private final WindowManager mWindowManager; @UnsupportedAppUsage @UiContext final Context mContext; @UnsupportedAppUsage final Window mWindow; Loading Loading @@ -158,7 +160,7 @@ public class Dialog implements DialogInterface, Window.Callback, * @param context the context in which the dialog should run * @see android.R.styleable#Theme_dialogTheme */ public Dialog(@NonNull Context context) { public Dialog(@UiContext @NonNull Context context) { this(context, 0, true); } Loading @@ -177,11 +179,12 @@ public class Dialog implements DialogInterface, Window.Callback, * @param themeResId a style resource describing the theme to use for the * window, or {@code 0} to use the default dialog theme */ public Dialog(@NonNull Context context, @StyleRes int themeResId) { public Dialog(@UiContext @NonNull Context context, @StyleRes int themeResId) { this(context, themeResId, true); } Dialog(@NonNull Context context, @StyleRes int themeResId, boolean createContextThemeWrapper) { Dialog(@UiContext @NonNull Context context, @StyleRes int themeResId, boolean createContextThemeWrapper) { if (createContextThemeWrapper) { if (themeResId == Resources.ID_NULL) { final TypedValue outValue = new TypedValue(); Loading Loading @@ -222,7 +225,7 @@ public class Dialog implements DialogInterface, Window.Callback, mCancelMessage = cancelCallback; } protected Dialog(@NonNull Context context, boolean cancelable, protected Dialog(@UiContext @NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) { this(context); mCancelable = cancelable; Loading @@ -234,7 +237,9 @@ public class Dialog implements DialogInterface, Window.Callback, * * @return Context The Context used by the Dialog. */ public final @NonNull Context getContext() { @UiContext @NonNull public final Context getContext() { return mContext; } Loading
core/java/android/app/WallpaperManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.annotation.UiContext; import android.compat.annotation.UnsupportedAppUsage; import android.content.ComponentName; import android.content.ContentResolver; Loading Loading @@ -213,7 +214,6 @@ public class WallpaperManager { private static final Object sSync = new Object[0]; @UnsupportedAppUsage private static Globals sGlobals; private final Context mContext; private final boolean mWcgEnabled; private final ColorManagementProxy mCmProxy; Loading Loading @@ -539,7 +539,8 @@ public class WallpaperManager { } } /*package*/ WallpaperManager(IWallpaperManager service, Context context, Handler handler) { /*package*/ WallpaperManager(IWallpaperManager service, @UiContext Context context, Handler handler) { mContext = context; if (service != null) { initGlobals(service, context.getMainLooper()); Loading
core/java/android/app/WindowContext.java +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.view.WindowManagerGlobal.ADD_TOO_MANY_TOKENS; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UiContext; import android.content.Context; import android.content.ContextWrapper; import android.os.Bundle; Loading @@ -42,6 +43,7 @@ import java.lang.ref.Reference; * @see Context#createWindowContext(int, Bundle) * @hide */ @UiContext public class WindowContext extends ContextWrapper { private final WindowManagerImpl mWindowManager; private final IWindowManager mWms; Loading
core/java/android/content/Context.java +9 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.CallbackExecutor; import android.annotation.CheckResult; import android.annotation.ColorInt; import android.annotation.ColorRes; import android.annotation.DisplayContext; import android.annotation.DrawableRes; import android.annotation.IntDef; import android.annotation.NonNull; Loading @@ -33,6 +34,7 @@ import android.annotation.StyleableRes; import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.TestApi; import android.annotation.UiContext; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.IApplicationThread; Loading Loading @@ -3750,6 +3752,7 @@ public abstract class Context { * @see #getSystemService(String) * @see android.view.WindowManager */ @UiContext public static final String WINDOW_SERVICE = "window"; /** Loading @@ -3760,6 +3763,7 @@ public abstract class Context { * @see #getSystemService(String) * @see android.view.LayoutInflater */ @UiContext public static final String LAYOUT_INFLATER_SERVICE = "layout_inflater"; /** Loading Loading @@ -3932,6 +3936,7 @@ public abstract class Context { * * @see #getSystemService(String) */ @UiContext public static final String WALLPAPER_SERVICE = "wallpaper"; /** Loading Loading @@ -5789,6 +5794,7 @@ public abstract class Context { * * @return A {@link Context} for the display. */ @DisplayContext public abstract Context createDisplayContext(@NonNull Display display); /** Loading Loading @@ -5853,7 +5859,9 @@ public abstract class Context { * the current number of window contexts without adding any view by * {@link WindowManager#addView} <b>exceeds five</b>. */ public @NonNull Context createWindowContext(@WindowType int type, @Nullable Bundle options) { @UiContext @NonNull public Context createWindowContext(@WindowType int type, @Nullable Bundle options) { throw new RuntimeException("Not implemented. Must override in a subclass."); } Loading