Loading core/java/android/annotation/DisplayContext.java 0 → 100644 +60 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.annotation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.app.Activity; import android.app.WallpaperManager; import android.content.Context; import android.os.Bundle; import android.view.Display; import android.view.LayoutInflater; import android.view.WindowManager; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Denotes a {@link Context} that is tied to a {@link Display} and can be used to obtain one * via {@link Context#getDisplay}, but <b>may not</b> be able to obtain {@link WindowManager}, * {@link LayoutInflater} or {@link WallpaperManager} via {@link Context#getSystemService(String)}. * If the UI services mentioned above are required, please use contexts which are marked as * {@link UiContext}. * <p> * {@link Activity}, and the result of {@link Context#createWindowContext(int, Bundle)} or * {@link Context#createDisplayContext(Display)} can be * used where a {@link DisplayContext} is required. * <p> * This is a marker annotation and has no specific attributes. * * @see Context#getDisplay() * @see Context#getSystemService(String) * @see Context#getSystemService(Class) * @see Context#createDisplayContext(Display) * @see Context#createWindowContext(int, Bundle) * @see UiContext * @hide */ @Retention(SOURCE) @Target({TYPE, METHOD, PARAMETER, FIELD}) public @interface DisplayContext { } core/java/android/annotation/NonUiContext.java 0 → 100644 +49 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.annotation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.app.WallpaperManager; import android.content.Context; import android.view.Display; import android.view.LayoutInflater; import android.view.WindowManager; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Denotes a {@link Context} that <b>can not</b> be used to obtain a {@link Display} via * {@link Context#getDisplay} nor to obtain a {@link WindowManager}, {@link LayoutInflater} or * {@link WallpaperManager} via {@link Context#getSystemService(String)}. * <p> * This is a marker annotation and has no specific attributes. * * @see Context#getDisplay() * @see Context#getSystemService(String) * @see Context#getSystemService(Class) * @hide */ @Retention(SOURCE) @Target({TYPE, METHOD, PARAMETER, FIELD}) public @interface NonUiContext { } core/java/android/annotation/UiContext.java 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.annotation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.app.Activity; import android.app.WallpaperManager; import android.content.Context; import android.os.Bundle; import android.view.Display; import android.view.LayoutInflater; import android.view.WindowManager; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Denotes a {@link Context} that can be used to create UI, meaning that it can provide a * {@link Display} via {@link Context#getDisplay} and can be used to obtain a {@link WindowManager}, * {@link LayoutInflater} or {@link WallpaperManager} via {@link Context#getSystemService(String)}. * A {@link Context} which is marked as {@link UiContext} implies that the {@link Context} is also * a {@link DisplayContext}. * <p> * This kind of {@link Context} is usually an {@link Activity} or * created via {@link Context#createWindowContext(int, Bundle)}. * </p> * This is a marker annotation and has no specific attributes. * * @see Context#getDisplay() * @see Context#getSystemService(String) * @see Context#getSystemService(Class) * @see Context#createWindowContext(int, Bundle) * @see DisplayContext * @hide */ @Retention(SOURCE) @Target({TYPE, METHOD, PARAMETER, FIELD}) public @interface UiContext { } Loading
core/java/android/annotation/DisplayContext.java 0 → 100644 +60 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.annotation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.app.Activity; import android.app.WallpaperManager; import android.content.Context; import android.os.Bundle; import android.view.Display; import android.view.LayoutInflater; import android.view.WindowManager; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Denotes a {@link Context} that is tied to a {@link Display} and can be used to obtain one * via {@link Context#getDisplay}, but <b>may not</b> be able to obtain {@link WindowManager}, * {@link LayoutInflater} or {@link WallpaperManager} via {@link Context#getSystemService(String)}. * If the UI services mentioned above are required, please use contexts which are marked as * {@link UiContext}. * <p> * {@link Activity}, and the result of {@link Context#createWindowContext(int, Bundle)} or * {@link Context#createDisplayContext(Display)} can be * used where a {@link DisplayContext} is required. * <p> * This is a marker annotation and has no specific attributes. * * @see Context#getDisplay() * @see Context#getSystemService(String) * @see Context#getSystemService(Class) * @see Context#createDisplayContext(Display) * @see Context#createWindowContext(int, Bundle) * @see UiContext * @hide */ @Retention(SOURCE) @Target({TYPE, METHOD, PARAMETER, FIELD}) public @interface DisplayContext { }
core/java/android/annotation/NonUiContext.java 0 → 100644 +49 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.annotation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.app.WallpaperManager; import android.content.Context; import android.view.Display; import android.view.LayoutInflater; import android.view.WindowManager; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Denotes a {@link Context} that <b>can not</b> be used to obtain a {@link Display} via * {@link Context#getDisplay} nor to obtain a {@link WindowManager}, {@link LayoutInflater} or * {@link WallpaperManager} via {@link Context#getSystemService(String)}. * <p> * This is a marker annotation and has no specific attributes. * * @see Context#getDisplay() * @see Context#getSystemService(String) * @see Context#getSystemService(Class) * @hide */ @Retention(SOURCE) @Target({TYPE, METHOD, PARAMETER, FIELD}) public @interface NonUiContext { }
core/java/android/annotation/UiContext.java 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.annotation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.app.Activity; import android.app.WallpaperManager; import android.content.Context; import android.os.Bundle; import android.view.Display; import android.view.LayoutInflater; import android.view.WindowManager; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Denotes a {@link Context} that can be used to create UI, meaning that it can provide a * {@link Display} via {@link Context#getDisplay} and can be used to obtain a {@link WindowManager}, * {@link LayoutInflater} or {@link WallpaperManager} via {@link Context#getSystemService(String)}. * A {@link Context} which is marked as {@link UiContext} implies that the {@link Context} is also * a {@link DisplayContext}. * <p> * This kind of {@link Context} is usually an {@link Activity} or * created via {@link Context#createWindowContext(int, Bundle)}. * </p> * This is a marker annotation and has no specific attributes. * * @see Context#getDisplay() * @see Context#getSystemService(String) * @see Context#getSystemService(Class) * @see Context#createWindowContext(int, Bundle) * @see DisplayContext * @hide */ @Retention(SOURCE) @Target({TYPE, METHOD, PARAMETER, FIELD}) public @interface UiContext { }