@Override public void dispatchAppVisibility(boolean visible) { // We don't do this in preview mode; we'll let the preview // activity tell us when to run. if (!mIWallpaperEngine.mIsPreview) { Message msg = mCaller.obtainMessageI(MSG_VISIBILITY_CHANGED, visible ? 1 : 0); mCaller.sendMessage(msg); } }
@Override public void resized( Rect frame, Rect contentInsets, Rect visibleInsets, boolean reportDraw, Configuration newConfig) { Message msg = mCaller.obtainMessageI(MSG_WINDOW_RESIZED, reportDraw ? 1 : 0); mCaller.sendMessage(msg); }
private void dispatchPointer(MotionEvent event) { if (event.isTouchEvent()) { synchronized (mLock) { if (event.getAction() == MotionEvent.ACTION_MOVE) { mPendingMove = event; } else { mPendingMove = null; } } Message msg = mCaller.obtainMessageO(MSG_TOUCH_EVENT, event); mCaller.sendMessage(msg); } else { event.recycle(); } }
@Override public IVoiceInteractorRequest startConfirmation( String callingPackage, IVoiceInteractorCallback callback, CharSequence prompt, Bundle extras) { Request request = newRequest(callback); mHandlerCaller.sendMessage( mHandlerCaller.obtainMessageOOOO( MSG_START_CONFIRMATION, new Caller(callingPackage, Binder.getCallingUid()), request, prompt, extras)); return request.mInterface; }
@Override public IVoiceInteractorRequest startAbortVoice( String callingPackage, IVoiceInteractorCallback callback, CharSequence message, Bundle extras) { Request request = newRequest(callback); mHandlerCaller.sendMessage( mHandlerCaller.obtainMessageOOOO( MSG_START_ABORT_VOICE, new Caller(callingPackage, Binder.getCallingUid()), request, message, extras)); return request.mInterface; }
@Override public IVoiceInteractorRequest startCommand( String callingPackage, IVoiceInteractorCallback callback, String command, Bundle extras) { Request request = newRequest(callback); mHandlerCaller.sendMessage( mHandlerCaller.obtainMessageOOOO( MSG_START_COMMAND, new Caller(callingPackage, Binder.getCallingUid()), request, command, extras)); return request.mInterface; }
@Override public void dispatchWallpaperCommand( String action, int x, int y, int z, Bundle extras, boolean sync) { synchronized (mLock) { if (DEBUG) Log.v(TAG, "Dispatch wallpaper command: " + x + ", " + y); WallpaperCommand cmd = new WallpaperCommand(); cmd.action = action; cmd.x = x; cmd.y = y; cmd.z = z; cmd.extras = extras; cmd.sync = sync; Message msg = mCaller.obtainMessage(MSG_WALLPAPER_COMMAND); msg.obj = cmd; mCaller.sendMessage(msg); } }
@Override public void dispatchWallpaperOffsets( float x, float y, float xStep, float yStep, boolean sync) { synchronized (mLock) { if (DEBUG) Log.v(TAG, "Dispatch wallpaper offsets: " + x + ", " + y); mPendingXOffset = x; mPendingYOffset = y; mPendingXOffsetStep = xStep; mPendingYOffsetStep = yStep; if (sync) { mPendingSync = true; } if (!mOffsetMessageEnqueued) { mOffsetMessageEnqueued = true; Message msg = mCaller.obtainMessage(MSG_WALLPAPER_OFFSETS); mCaller.sendMessage(msg); } } }
IWallpaperEngineWrapper( WallpaperService context, IWallpaperConnection conn, IBinder windowToken, int windowType, boolean isPreview, int reqWidth, int reqHeight) { if (DEBUG && mCallbackLooper != null) { mCallbackLooper.setMessageLogging(new LogPrinter(Log.VERBOSE, TAG)); } mCaller = new HandlerCaller( context, mCallbackLooper != null ? mCallbackLooper : context.getMainLooper(), this); mConnection = conn; mWindowToken = windowToken; mWindowType = windowType; mIsPreview = isPreview; mReqWidth = reqWidth; mReqHeight = reqHeight; Message msg = mCaller.obtainMessage(DO_ATTACH); mCaller.sendMessage(msg); }
@Override public void closeSystemDialogs() { mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_CLOSE_SYSTEM_DIALOGS)); }
@Override public void taskFinished(Intent intent, int taskId) { mHandlerCaller.sendMessage( mHandlerCaller.obtainMessageIO(MSG_TASK_FINISHED, taskId, intent)); }
@Override public void taskStarted(Intent intent, int taskId) { mHandlerCaller.sendMessage( mHandlerCaller.obtainMessageIO(MSG_TASK_STARTED, taskId, intent)); }
public void onAccessibilityEvent(AccessibilityEvent event) { Message message = mCaller.obtainMessageO(DO_ON_ACCESSIBILITY_EVENT, event); mCaller.sendMessage(message); }
public void setVisibility(boolean visible) { Message msg = mCaller.obtainMessageI(MSG_VISIBILITY_CHANGED, visible ? 1 : 0); mCaller.sendMessage(msg); }
public void onInterrupt() { Message message = mCaller.obtainMessage(DO_ON_INTERRUPT); mCaller.sendMessage(message); }
@Override public void moved(int newX, int newY) { Message msg = mCaller.obtainMessageII(MSG_WINDOW_MOVED, newX, newY); mCaller.sendMessage(msg); }
@Override public void onUpdateSurface() { Message msg = mCaller.obtainMessage(MSG_UPDATE_SURFACE); mCaller.sendMessage(msg); }
@Override public void onRelayoutContainer() { Message msg = mCaller.obtainMessage(MSG_UPDATE_SURFACE); mCaller.sendMessage(msg); }
public void destroy() { Message msg = mCaller.obtainMessage(DO_DETACH); mCaller.sendMessage(msg); }
@Override public void destroy() { mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_DESTROY)); }
public void setConnection(IAccessibilityServiceConnection connection) { Message message = mCaller.obtainMessageO(DO_SET_SET_CONNECTION, connection); mCaller.sendMessage(message); }
public void setDesiredSize(int width, int height) { Message msg = mCaller.obtainMessageII(DO_SET_DESIRED_SIZE, width, height); mCaller.sendMessage(msg); }