Merge "Add MainThread annotations to WallpaperService callbacks"

This commit is contained in:
Aurélien Pomini
2022-11-15 12:15:36 +00:00
committed by Android (Google) Code Review
3 changed files with 33 additions and 16 deletions

View File

@@ -39931,7 +39931,7 @@ package android.service.wallpaper {
public abstract class WallpaperService extends android.app.Service {
ctor public WallpaperService();
method public final android.os.IBinder onBind(android.content.Intent);
method public abstract android.service.wallpaper.WallpaperService.Engine onCreateEngine();
method @MainThread public abstract android.service.wallpaper.WallpaperService.Engine onCreateEngine();
field public static final String SERVICE_INTERFACE = "android.service.wallpaper.WallpaperService";
field public static final String SERVICE_META_DATA = "android.service.wallpaper";
}
@@ -39946,20 +39946,20 @@ package android.service.wallpaper {
method public boolean isPreview();
method public boolean isVisible();
method public void notifyColorsChanged();
method public void onApplyWindowInsets(android.view.WindowInsets);
method public android.os.Bundle onCommand(String, int, int, int, android.os.Bundle, boolean);
method @Nullable public android.app.WallpaperColors onComputeColors();
method public void onCreate(android.view.SurfaceHolder);
method public void onDesiredSizeChanged(int, int);
method public void onDestroy();
method public void onOffsetsChanged(float, float, float, float, int, int);
method public void onSurfaceChanged(android.view.SurfaceHolder, int, int, int);
method public void onSurfaceCreated(android.view.SurfaceHolder);
method public void onSurfaceDestroyed(android.view.SurfaceHolder);
method public void onSurfaceRedrawNeeded(android.view.SurfaceHolder);
method public void onTouchEvent(android.view.MotionEvent);
method public void onVisibilityChanged(boolean);
method public void onZoomChanged(@FloatRange(from=0.0f, to=1.0f) float);
method @MainThread public void onApplyWindowInsets(android.view.WindowInsets);
method @MainThread public android.os.Bundle onCommand(String, int, int, int, android.os.Bundle, boolean);
method @MainThread @Nullable public android.app.WallpaperColors onComputeColors();
method @MainThread public void onCreate(android.view.SurfaceHolder);
method @MainThread public void onDesiredSizeChanged(int, int);
method @MainThread public void onDestroy();
method @MainThread public void onOffsetsChanged(float, float, float, float, int, int);
method @MainThread public void onSurfaceChanged(android.view.SurfaceHolder, int, int, int);
method @MainThread public void onSurfaceCreated(android.view.SurfaceHolder);
method @MainThread public void onSurfaceDestroyed(android.view.SurfaceHolder);
method @MainThread public void onSurfaceRedrawNeeded(android.view.SurfaceHolder);
method @MainThread public void onTouchEvent(android.view.MotionEvent);
method @MainThread public void onVisibilityChanged(boolean);
method @MainThread public void onZoomChanged(@FloatRange(from=0.0f, to=1.0f) float);
method public void setOffsetNotificationsEnabled(boolean);
method public void setTouchEventsEnabled(boolean);
}

View File

@@ -12226,7 +12226,7 @@ package android.service.wallpaper {
public class WallpaperService.Engine {
method public boolean isInAmbientMode();
method public void onAmbientModeChanged(boolean, long);
method @MainThread public void onAmbientModeChanged(boolean, long);
}
}

View File

@@ -31,6 +31,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.annotation.FloatRange;
import android.annotation.MainThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SdkConstant;
@@ -657,6 +658,7 @@ public abstract class WallpaperService extends Service {
* Called once to initialize the engine. After returning, the
* engine's surface will be created by the framework.
*/
@MainThread
public void onCreate(SurfaceHolder surfaceHolder) {
}
@@ -665,6 +667,7 @@ public abstract class WallpaperService extends Service {
* surface will be destroyed and this Engine object is no longer
* valid.
*/
@MainThread
public void onDestroy() {
}
@@ -673,6 +676,7 @@ public abstract class WallpaperService extends Service {
* hidden. <em>It is very important that a wallpaper only use
* CPU while it is visible.</em>.
*/
@MainThread
public void onVisibilityChanged(boolean visible) {
}
@@ -683,6 +687,7 @@ public abstract class WallpaperService extends Service {
*
* @param insets Insets to apply.
*/
@MainThread
public void onApplyWindowInsets(WindowInsets insets) {
}
@@ -693,6 +698,7 @@ public abstract class WallpaperService extends Service {
* user is interacting with, so if it is slow you will get fewer
* move events.
*/
@MainThread
public void onTouchEvent(MotionEvent event) {
}
@@ -702,6 +708,7 @@ public abstract class WallpaperService extends Service {
* call to {@link WallpaperManager#setWallpaperOffsets(IBinder, float, float)
* WallpaperManager.setWallpaperOffsets()}.
*/
@MainThread
public void onOffsetsChanged(float xOffset, float yOffset,
float xOffsetStep, float yOffsetStep,
int xPixelOffset, int yPixelOffset) {
@@ -724,6 +731,7 @@ public abstract class WallpaperService extends Service {
* @return If returning a result, create a Bundle and place the
* result data in to it. Otherwise return null.
*/
@MainThread
public Bundle onCommand(String action, int x, int y, int z,
Bundle extras, boolean resultRequested) {
return null;
@@ -742,6 +750,7 @@ public abstract class WallpaperService extends Service {
* @hide
*/
@SystemApi
@MainThread
public void onAmbientModeChanged(boolean inAmbientMode, long animationDuration) {
}
@@ -749,6 +758,7 @@ public abstract class WallpaperService extends Service {
* Called when an application has changed the desired virtual size of
* the wallpaper.
*/
@MainThread
public void onDesiredSizeChanged(int desiredWidth, int desiredHeight) {
}
@@ -756,6 +766,7 @@ public abstract class WallpaperService extends Service {
* Convenience for {@link SurfaceHolder.Callback#surfaceChanged
* SurfaceHolder.Callback.surfaceChanged()}.
*/
@MainThread
public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
@@ -763,6 +774,7 @@ public abstract class WallpaperService extends Service {
* Convenience for {@link SurfaceHolder.Callback2#surfaceRedrawNeeded
* SurfaceHolder.Callback.surfaceRedrawNeeded()}.
*/
@MainThread
public void onSurfaceRedrawNeeded(SurfaceHolder holder) {
}
@@ -770,6 +782,7 @@ public abstract class WallpaperService extends Service {
* Convenience for {@link SurfaceHolder.Callback#surfaceCreated
* SurfaceHolder.Callback.surfaceCreated()}.
*/
@MainThread
public void onSurfaceCreated(SurfaceHolder holder) {
}
@@ -777,6 +790,7 @@ public abstract class WallpaperService extends Service {
* Convenience for {@link SurfaceHolder.Callback#surfaceDestroyed
* SurfaceHolder.Callback.surfaceDestroyed()}.
*/
@MainThread
public void onSurfaceDestroyed(SurfaceHolder holder) {
}
@@ -787,6 +801,7 @@ public abstract class WallpaperService extends Service {
* @param zoom the zoom level, between 0 indicating fully zoomed in and 1 indicating fully
* zoomed out.
*/
@MainThread
public void onZoomChanged(@FloatRange(from = 0f, to = 1f) float zoom) {
}
@@ -836,6 +851,7 @@ public abstract class WallpaperService extends Service {
*
* @return Wallpaper colors.
*/
@MainThread
public @Nullable WallpaperColors onComputeColors() {
return null;
}
@@ -2510,6 +2526,7 @@ public abstract class WallpaperService extends Service {
* when the wallpaper is currently set as the active wallpaper and the user
* is in the wallpaper picker viewing a preview of it as well.
*/
@MainThread
public abstract Engine onCreateEngine();
@Override