Search in sources :

Example 26 with IRemoteCallback

use of android.os.IRemoteCallback in project android_frameworks_base by DirtyUnicorns.

the class WallpaperManagerService method systemReady.

void systemReady() {
    if (DEBUG)
        Slog.v(TAG, "systemReady");
    WallpaperData wallpaper = mWallpaperMap.get(UserHandle.USER_SYSTEM);
    // sure we have something to render
    if (mImageWallpaper.equals(wallpaper.nextWallpaperComponent)) {
        // No crop file? Make sure we've finished the processing sequence if necessary
        if (!wallpaper.cropExists()) {
            if (DEBUG) {
                Slog.i(TAG, "No crop; regenerating from source");
            }
            generateCrop(wallpaper);
        }
        // Still nothing?  Fall back to default.
        if (!wallpaper.cropExists()) {
            if (DEBUG) {
                Slog.i(TAG, "Unable to regenerate crop; resetting");
            }
            clearWallpaperLocked(false, FLAG_SYSTEM, UserHandle.USER_SYSTEM, null);
        }
    } else {
        if (DEBUG) {
            Slog.i(TAG, "Nondefault wallpaper component; gracefully ignoring");
        }
    }
    IntentFilter userFilter = new IntentFilter();
    userFilter.addAction(Intent.ACTION_USER_REMOVED);
    mContext.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            final String action = intent.getAction();
            if (Intent.ACTION_USER_REMOVED.equals(action)) {
                onRemoveUser(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL));
            }
        }
    }, userFilter);
    final IntentFilter shutdownFilter = new IntentFilter(Intent.ACTION_SHUTDOWN);
    mContext.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            if (Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
                if (DEBUG) {
                    Slog.i(TAG, "Shutting down");
                }
                synchronized (mLock) {
                    mShuttingDown = true;
                }
            }
        }
    }, shutdownFilter);
    try {
        ActivityManagerNative.getDefault().registerUserSwitchObserver(new IUserSwitchObserver.Stub() {

            @Override
            public void onUserSwitching(int newUserId, IRemoteCallback reply) {
                switchUser(newUserId, reply);
            }

            @Override
            public void onUserSwitchComplete(int newUserId) throws RemoteException {
            }

            @Override
            public void onForegroundProfileSwitch(int newProfileId) {
            // Ignore.
            }
        }, TAG);
    } catch (RemoteException e) {
        e.rethrowAsRuntimeException();
    }
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) IRemoteCallback(android.os.IRemoteCallback) IUserSwitchObserver(android.app.IUserSwitchObserver) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) RemoteException(android.os.RemoteException) Point(android.graphics.Point)

Example 27 with IRemoteCallback

use of android.os.IRemoteCallback in project cornerstone by Onskreen.

the class WindowManagerService method waitForWindowDrawn.

public void waitForWindowDrawn(IBinder token, IRemoteCallback callback) {
    synchronized (mWindowMap) {
        WindowState win = windowForClientLocked(null, token, true);
        if (win != null) {
            Pair<WindowState, IRemoteCallback> pair = new Pair<WindowState, IRemoteCallback>(win, callback);
            Message m = mH.obtainMessage(H.WAITING_FOR_DRAWN_TIMEOUT, pair);
            mH.sendMessageDelayed(m, 2000);
            mWaitingForDrawn.add(pair);
            checkDrawnWindowsLocked();
        }
    }
}
Also used : IRemoteCallback(android.os.IRemoteCallback) Message(android.os.Message) Pair(android.util.Pair)

Example 28 with IRemoteCallback

use of android.os.IRemoteCallback in project android_frameworks_base by ResurrectionRemix.

the class AppTransition method createAspectScaledThumbnailFreeformAnimationLocked.

private AnimationSet createAspectScaledThumbnailFreeformAnimationLocked(Rect sourceFrame, Rect destFrame, @Nullable Rect surfaceInsets, boolean enter) {
    final float sourceWidth = sourceFrame.width();
    final float sourceHeight = sourceFrame.height();
    final float destWidth = destFrame.width();
    final float destHeight = destFrame.height();
    final float scaleH = enter ? sourceWidth / destWidth : destWidth / sourceWidth;
    final float scaleV = enter ? sourceHeight / destHeight : destHeight / sourceHeight;
    AnimationSet set = new AnimationSet(true);
    final int surfaceInsetsH = surfaceInsets == null ? 0 : surfaceInsets.left + surfaceInsets.right;
    final int surfaceInsetsV = surfaceInsets == null ? 0 : surfaceInsets.top + surfaceInsets.bottom;
    // We want the scaling to happen from the center of the surface. In order to achieve that,
    // we need to account for surface insets that will be used to enlarge the surface.
    final float scaleHCenter = ((enter ? destWidth : sourceWidth) + surfaceInsetsH) / 2;
    final float scaleVCenter = ((enter ? destHeight : sourceHeight) + surfaceInsetsV) / 2;
    final ScaleAnimation scale = enter ? new ScaleAnimation(scaleH, 1, scaleV, 1, scaleHCenter, scaleVCenter) : new ScaleAnimation(1, scaleH, 1, scaleV, scaleHCenter, scaleVCenter);
    final int sourceHCenter = sourceFrame.left + sourceFrame.width() / 2;
    final int sourceVCenter = sourceFrame.top + sourceFrame.height() / 2;
    final int destHCenter = destFrame.left + destFrame.width() / 2;
    final int destVCenter = destFrame.top + destFrame.height() / 2;
    final int fromX = enter ? sourceHCenter - destHCenter : destHCenter - sourceHCenter;
    final int fromY = enter ? sourceVCenter - destVCenter : destVCenter - sourceVCenter;
    final TranslateAnimation translation = enter ? new TranslateAnimation(fromX, 0, fromY, 0) : new TranslateAnimation(0, fromX, 0, fromY);
    set.addAnimation(scale);
    set.addAnimation(translation);
    final IRemoteCallback callback = mAnimationFinishedCallback;
    if (callback != null) {
        set.setAnimationListener(new Animation.AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                mService.mH.obtainMessage(H.DO_ANIMATION_CALLBACK, callback).sendToTarget();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
    }
    return set;
}
Also used : IRemoteCallback(android.os.IRemoteCallback) CurvedTranslateAnimation(com.android.server.wm.animation.CurvedTranslateAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) WindowAnimation_wallpaperCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperCloseExitAnimation) CurvedTranslateAnimation(com.android.server.wm.animation.CurvedTranslateAnimation) WindowAnimation_activityOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation) WindowAnimation_wallpaperOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperOpenExitAnimation) WindowAnimation_taskToBackEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation) WindowAnimation_activityOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) ClipRectAnimation(android.view.animation.ClipRectAnimation) WindowAnimation_wallpaperOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperOpenEnterAnimation) WindowAnimation_launchTaskBehindTargetAnimation(com.android.internal.R.styleable.WindowAnimation_launchTaskBehindTargetAnimation) WindowAnimation_launchTaskBehindSourceAnimation(com.android.internal.R.styleable.WindowAnimation_launchTaskBehindSourceAnimation) WindowAnimation_taskCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) WindowAnimation_wallpaperIntraCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseEnterAnimation) WindowAnimation_taskToBackExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation) WindowAnimation_activityCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation) WindowAnimation_taskCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation) WindowAnimation_taskOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation) WindowAnimation_wallpaperIntraCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseExitAnimation) ClipRectTBAnimation(com.android.server.wm.animation.ClipRectTBAnimation) WindowAnimation_taskOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation) ClipRectLRAnimation(com.android.server.wm.animation.ClipRectLRAnimation) WindowAnimation_activityCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation) WindowAnimation_taskToFrontEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation) WindowAnimation_wallpaperIntraOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenEnterAnimation) WindowAnimation_wallpaperIntraOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenExitAnimation) WindowAnimation_taskToFrontExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation) WindowAnimation_wallpaperCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation) AnimationSet(android.view.animation.AnimationSet) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 29 with IRemoteCallback

use of android.os.IRemoteCallback in project android_frameworks_base by ResurrectionRemix.

the class WallpaperManagerService method systemReady.

void systemReady() {
    if (DEBUG)
        Slog.v(TAG, "systemReady");
    WallpaperData wallpaper = mWallpaperMap.get(UserHandle.USER_SYSTEM);
    // sure we have something to render
    if (mImageWallpaper.equals(wallpaper.nextWallpaperComponent)) {
        // No crop file? Make sure we've finished the processing sequence if necessary
        if (!wallpaper.cropExists()) {
            if (DEBUG) {
                Slog.i(TAG, "No crop; regenerating from source");
            }
            generateCrop(wallpaper);
        }
        // Still nothing?  Fall back to default.
        if (!wallpaper.cropExists()) {
            if (DEBUG) {
                Slog.i(TAG, "Unable to regenerate crop; resetting");
            }
            clearWallpaperLocked(false, FLAG_SYSTEM, UserHandle.USER_SYSTEM, null);
        }
    } else {
        if (DEBUG) {
            Slog.i(TAG, "Nondefault wallpaper component; gracefully ignoring");
        }
    }
    IntentFilter userFilter = new IntentFilter();
    userFilter.addAction(Intent.ACTION_USER_REMOVED);
    mContext.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            final String action = intent.getAction();
            if (Intent.ACTION_USER_REMOVED.equals(action)) {
                onRemoveUser(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL));
            }
        }
    }, userFilter);
    final IntentFilter shutdownFilter = new IntentFilter(Intent.ACTION_SHUTDOWN);
    mContext.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            if (Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
                if (DEBUG) {
                    Slog.i(TAG, "Shutting down");
                }
                synchronized (mLock) {
                    mShuttingDown = true;
                }
            }
        }
    }, shutdownFilter);
    try {
        ActivityManagerNative.getDefault().registerUserSwitchObserver(new IUserSwitchObserver.Stub() {

            @Override
            public void onUserSwitching(int newUserId, IRemoteCallback reply) {
                switchUser(newUserId, reply);
            }

            @Override
            public void onUserSwitchComplete(int newUserId) throws RemoteException {
            }

            @Override
            public void onForegroundProfileSwitch(int newProfileId) {
            // Ignore.
            }
        }, TAG);
    } catch (RemoteException e) {
        e.rethrowAsRuntimeException();
    }
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) IRemoteCallback(android.os.IRemoteCallback) IUserSwitchObserver(android.app.IUserSwitchObserver) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) RemoteException(android.os.RemoteException) Point(android.graphics.Point)

Example 30 with IRemoteCallback

use of android.os.IRemoteCallback in project android_frameworks_base by crdroidandroid.

the class WallpaperManagerService method systemReady.

void systemReady() {
    if (DEBUG)
        Slog.v(TAG, "systemReady");
    WallpaperData wallpaper = mWallpaperMap.get(UserHandle.USER_SYSTEM);
    // sure we have something to render
    if (mImageWallpaper.equals(wallpaper.nextWallpaperComponent)) {
        // No crop file? Make sure we've finished the processing sequence if necessary
        if (!wallpaper.cropExists()) {
            if (DEBUG) {
                Slog.i(TAG, "No crop; regenerating from source");
            }
            generateCrop(wallpaper);
        }
        // Still nothing?  Fall back to default.
        if (!wallpaper.cropExists()) {
            if (DEBUG) {
                Slog.i(TAG, "Unable to regenerate crop; resetting");
            }
            clearWallpaperLocked(false, FLAG_SYSTEM, UserHandle.USER_SYSTEM, null);
        }
    } else {
        if (DEBUG) {
            Slog.i(TAG, "Nondefault wallpaper component; gracefully ignoring");
        }
    }
    IntentFilter userFilter = new IntentFilter();
    userFilter.addAction(Intent.ACTION_USER_REMOVED);
    mContext.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            final String action = intent.getAction();
            if (Intent.ACTION_USER_REMOVED.equals(action)) {
                onRemoveUser(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL));
            }
        }
    }, userFilter);
    final IntentFilter shutdownFilter = new IntentFilter(Intent.ACTION_SHUTDOWN);
    mContext.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            if (Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
                if (DEBUG) {
                    Slog.i(TAG, "Shutting down");
                }
                synchronized (mLock) {
                    mShuttingDown = true;
                }
            }
        }
    }, shutdownFilter);
    try {
        ActivityManagerNative.getDefault().registerUserSwitchObserver(new IUserSwitchObserver.Stub() {

            @Override
            public void onUserSwitching(int newUserId, IRemoteCallback reply) {
                switchUser(newUserId, reply);
            }

            @Override
            public void onUserSwitchComplete(int newUserId) throws RemoteException {
            }

            @Override
            public void onForegroundProfileSwitch(int newProfileId) {
            // Ignore.
            }
        }, TAG);
    } catch (RemoteException e) {
        e.rethrowAsRuntimeException();
    }
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) IRemoteCallback(android.os.IRemoteCallback) IUserSwitchObserver(android.app.IUserSwitchObserver) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) RemoteException(android.os.RemoteException) Point(android.graphics.Point)

Aggregations

IRemoteCallback (android.os.IRemoteCallback)30 Bundle (android.os.Bundle)14 RemoteException (android.os.RemoteException)14 Point (android.graphics.Point)9 Message (android.os.Message)8 IUserSwitchObserver (android.app.IUserSwitchObserver)5 PendingIntent (android.app.PendingIntent)5 BroadcastReceiver (android.content.BroadcastReceiver)5 Context (android.content.Context)5 Intent (android.content.Intent)5 IntentFilter (android.content.IntentFilter)5 ArraySet (android.util.ArraySet)4 AlphaAnimation (android.view.animation.AlphaAnimation)4 Animation (android.view.animation.Animation)4 AnimationSet (android.view.animation.AnimationSet)4 ClipRectAnimation (android.view.animation.ClipRectAnimation)4 ScaleAnimation (android.view.animation.ScaleAnimation)4 TranslateAnimation (android.view.animation.TranslateAnimation)4 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)4 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)4