Search in sources :

Example 16 with IRemoteCallback

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

the class WallpaperManagerService method systemReady.

public void systemReady() {
    if (DEBUG)
        Slog.v(TAG, "systemReady");
    WallpaperData wallpaper = mWallpaperMap.get(UserHandle.USER_OWNER);
    switchWallpaper(wallpaper, null);
    wallpaper.wallpaperObserver = new WallpaperObserver(wallpaper);
    wallpaper.wallpaperObserver.startWatching();
    IntentFilter userFilter = new IntentFilter();
    userFilter.addAction(Intent.ACTION_USER_REMOVED);
    userFilter.addAction(Intent.ACTION_USER_STOPPING);
    mContext.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (Intent.ACTION_USER_REMOVED.equals(action)) {
                onRemoveUser(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL));
            }
        // TODO: Race condition causing problems when cleaning up on stopping a user.
        // Comment this out for now.
        // else if (Intent.ACTION_USER_STOPPING.equals(action)) {
        //     onStoppingUser(intent.getIntExtra(Intent.EXTRA_USER_HANDLE,
        //             UserHandle.USER_NULL));
        // }
        }
    }, userFilter);
    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 {
            }
        });
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
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)

Example 17 with IRemoteCallback

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

the class ActivityManagerService method dispatchUserSwitch.

void dispatchUserSwitch(final UserStartedState uss, final int oldUserId, final int newUserId) {
    final int N = mUserSwitchObservers.beginBroadcast();
    if (N > 0) {
        final IRemoteCallback callback = new IRemoteCallback.Stub() {

            int mCount = 0;

            @Override
            public void sendResult(Bundle data) throws RemoteException {
                synchronized (ActivityManagerService.this) {
                    if (mCurUserSwitchCallback == this) {
                        mCount++;
                        if (mCount == N) {
                            sendContinueUserSwitchLocked(uss, oldUserId, newUserId);
                        }
                    }
                }
            }
        };
        synchronized (this) {
            uss.switching = true;
            mCurUserSwitchCallback = callback;
        }
        for (int i = 0; i < N; i++) {
            try {
                mUserSwitchObservers.getBroadcastItem(i).onUserSwitching(newUserId, callback);
            } catch (RemoteException e) {
            }
        }
    } else {
        synchronized (this) {
            sendContinueUserSwitchLocked(uss, oldUserId, newUserId);
        }
    }
    mUserSwitchObservers.finishBroadcast();
}
Also used : IRemoteCallback(android.os.IRemoteCallback) Bundle(android.os.Bundle) RemoteException(android.os.RemoteException)

Example 18 with IRemoteCallback

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

the class WindowManagerService method checkDrawnWindowsLocked.

void checkDrawnWindowsLocked() {
    if (mWaitingForDrawn.size() > 0) {
        for (int j = mWaitingForDrawn.size() - 1; j >= 0; j--) {
            Pair<WindowState, IRemoteCallback> pair = mWaitingForDrawn.get(j);
            WindowState win = pair.first;
            //        + " shown=" + win.mSurfaceShown);
            if (win.mRemoved || !win.isVisibleLw()) {
                // Window has been removed or made invisible; no draw
                // will now happen, so stop waiting.
                Slog.w(TAG, "Aborted waiting for drawn: " + pair.first);
                try {
                    pair.second.sendResult(null);
                } catch (RemoteException e) {
                }
                mWaitingForDrawn.remove(pair);
                mH.removeMessages(H.WAITING_FOR_DRAWN_TIMEOUT, pair);
            } else if (win.mWinAnimator.mSurfaceShown) {
                // Window is now drawn (and shown).
                try {
                    pair.second.sendResult(null);
                } catch (RemoteException e) {
                }
                mWaitingForDrawn.remove(pair);
                mH.removeMessages(H.WAITING_FOR_DRAWN_TIMEOUT, pair);
            }
        }
    }
}
Also used : IRemoteCallback(android.os.IRemoteCallback) RemoteException(android.os.RemoteException) Point(android.graphics.Point)

Example 19 with IRemoteCallback

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

the class WindowManagerService method dumpWindowsNoHeaderLocked.

void dumpWindowsNoHeaderLocked(PrintWriter pw, boolean dumpAll, ArrayList<WindowState> windows) {
    int j = 0;
    final int numDisplays = mDisplayContents.size();
    for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
        final WindowList windowList = mDisplayContents.valueAt(displayNdx).getWindowList();
        for (int winNdx = windowList.size() - 1; winNdx >= 0; --winNdx) {
            final WindowState w = windowList.get(winNdx);
            if (windows == null || windows.contains(w)) {
                pw.print("  Window #");
                pw.print(j++);
                pw.print(' ');
                pw.print(w);
                pw.println(":");
                w.dump(pw, "    ", dumpAll || windows != null);
            }
        }
    }
    if (mInputMethodDialogs.size() > 0) {
        pw.println();
        pw.println("  Input method dialogs:");
        for (int i = mInputMethodDialogs.size() - 1; i >= 0; i--) {
            WindowState w = mInputMethodDialogs.get(i);
            if (windows == null || windows.contains(w)) {
                pw.print("  IM Dialog #");
                pw.print(i);
                pw.print(": ");
                pw.println(w);
            }
        }
    }
    if (mPendingRemove.size() > 0) {
        pw.println();
        pw.println("  Remove pending for:");
        for (int i = mPendingRemove.size() - 1; i >= 0; i--) {
            WindowState w = mPendingRemove.get(i);
            if (windows == null || windows.contains(w)) {
                pw.print("  Remove #");
                pw.print(i);
                pw.print(' ');
                pw.print(w);
                if (dumpAll) {
                    pw.println(":");
                    w.dump(pw, "    ", true);
                } else {
                    pw.println();
                }
            }
        }
    }
    if (mForceRemoves != null && mForceRemoves.size() > 0) {
        pw.println();
        pw.println("  Windows force removing:");
        for (int i = mForceRemoves.size() - 1; i >= 0; i--) {
            WindowState w = mForceRemoves.get(i);
            pw.print("  Removing #");
            pw.print(i);
            pw.print(' ');
            pw.print(w);
            if (dumpAll) {
                pw.println(":");
                w.dump(pw, "    ", true);
            } else {
                pw.println();
            }
        }
    }
    if (mDestroySurface.size() > 0) {
        pw.println();
        pw.println("  Windows waiting to destroy their surface:");
        for (int i = mDestroySurface.size() - 1; i >= 0; i--) {
            WindowState w = mDestroySurface.get(i);
            if (windows == null || windows.contains(w)) {
                pw.print("  Destroy #");
                pw.print(i);
                pw.print(' ');
                pw.print(w);
                if (dumpAll) {
                    pw.println(":");
                    w.dump(pw, "    ", true);
                } else {
                    pw.println();
                }
            }
        }
    }
    if (mLosingFocus.size() > 0) {
        pw.println();
        pw.println("  Windows losing focus:");
        for (int i = mLosingFocus.size() - 1; i >= 0; i--) {
            WindowState w = mLosingFocus.get(i);
            if (windows == null || windows.contains(w)) {
                pw.print("  Losing #");
                pw.print(i);
                pw.print(' ');
                pw.print(w);
                if (dumpAll) {
                    pw.println(":");
                    w.dump(pw, "    ", true);
                } else {
                    pw.println();
                }
            }
        }
    }
    if (mResizingWindows.size() > 0) {
        pw.println();
        pw.println("  Windows waiting to resize:");
        for (int i = mResizingWindows.size() - 1; i >= 0; i--) {
            WindowState w = mResizingWindows.get(i);
            if (windows == null || windows.contains(w)) {
                pw.print("  Resizing #");
                pw.print(i);
                pw.print(' ');
                pw.print(w);
                if (dumpAll) {
                    pw.println(":");
                    w.dump(pw, "    ", true);
                } else {
                    pw.println();
                }
            }
        }
    }
    if (mWaitingForDrawn.size() > 0) {
        pw.println();
        pw.println("  Clients waiting for these windows to be drawn:");
        for (int i = mWaitingForDrawn.size() - 1; i >= 0; i--) {
            Pair<WindowState, IRemoteCallback> pair = mWaitingForDrawn.get(i);
            pw.print("  Waiting #");
            pw.print(i);
            pw.print(' ');
            pw.print(pair.first);
            pw.print(": ");
            pw.println(pair.second);
        }
    }
    pw.println();
    pw.print("  mCurConfiguration=");
    pw.println(this.mCurConfiguration);
    pw.print("  mCurrentFocus=");
    pw.println(mCurrentFocus);
    if (mLastFocus != mCurrentFocus) {
        pw.print("  mLastFocus=");
        pw.println(mLastFocus);
    }
    pw.print("  mFocusedApp=");
    pw.println(mFocusedApp);
    if (mInputMethodTarget != null) {
        pw.print("  mInputMethodTarget=");
        pw.println(mInputMethodTarget);
    }
    pw.print("  mInTouchMode=");
    pw.print(mInTouchMode);
    pw.print(" mLayoutSeq=");
    pw.println(mLayoutSeq);
    pw.print("  mLastDisplayFreezeDuration=");
    TimeUtils.formatDuration(mLastDisplayFreezeDuration, pw);
    if (mLastFinishedFreezeSource != null) {
        pw.print(" due to ");
        pw.print(mLastFinishedFreezeSource);
    }
    pw.println();
    if (dumpAll) {
        pw.print("  mSystemDecorRect=");
        pw.print(mSystemDecorRect.toShortString());
        pw.print(" mSystemDecorLayer=");
        pw.print(mSystemDecorLayer);
        pw.print(" mScreenRect=");
        pw.println(mScreenRect.toShortString());
        if (mLastStatusBarVisibility != 0) {
            pw.print("  mLastStatusBarVisibility=0x");
            pw.println(Integer.toHexString(mLastStatusBarVisibility));
        }
        if (mInputMethodWindow != null) {
            pw.print("  mInputMethodWindow=");
            pw.println(mInputMethodWindow);
        }
        pw.print("  mWallpaperTarget=");
        pw.println(mWallpaperTarget);
        if (mLowerWallpaperTarget != null || mUpperWallpaperTarget != null) {
            pw.print("  mLowerWallpaperTarget=");
            pw.println(mLowerWallpaperTarget);
            pw.print("  mUpperWallpaperTarget=");
            pw.println(mUpperWallpaperTarget);
        }
        pw.print("  mLastWallpaperX=");
        pw.print(mLastWallpaperX);
        pw.print(" mLastWallpaperY=");
        pw.println(mLastWallpaperY);
        if (mInputMethodAnimLayerAdjustment != 0 || mWallpaperAnimLayerAdjustment != 0) {
            pw.print("  mInputMethodAnimLayerAdjustment=");
            pw.print(mInputMethodAnimLayerAdjustment);
            pw.print("  mWallpaperAnimLayerAdjustment=");
            pw.println(mWallpaperAnimLayerAdjustment);
        }
        pw.print("  mSystemBooted=");
        pw.print(mSystemBooted);
        pw.print(" mDisplayEnabled=");
        pw.println(mDisplayEnabled);
        if (needsLayout()) {
            pw.print("  layoutNeeded on displays=");
            for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
                final DisplayContent displayContent = mDisplayContents.valueAt(displayNdx);
                if (displayContent.layoutNeeded) {
                    pw.print(displayContent.getDisplayId());
                }
            }
            pw.println();
        }
        pw.print("  mTransactionSequence=");
        pw.println(mTransactionSequence);
        pw.print("  mDisplayFrozen=");
        pw.print(mDisplayFrozen);
        pw.print(" windows=");
        pw.print(mWindowsFreezingScreen);
        pw.print(" client=");
        pw.print(mClientFreezingScreen);
        pw.print(" apps=");
        pw.print(mAppsFreezingScreen);
        pw.print(" waitingForConfig=");
        pw.println(mWaitingForConfig);
        pw.print("  mRotation=");
        pw.print(mRotation);
        pw.print(" mAltOrientation=");
        pw.println(mAltOrientation);
        pw.print("  mLastWindowForcedOrientation=");
        pw.print(mLastWindowForcedOrientation);
        pw.print(" mForcedAppOrientation=");
        pw.println(mForcedAppOrientation);
        pw.print("  mDeferredRotationPauseCount=");
        pw.println(mDeferredRotationPauseCount);
        pw.print("  mWindowAnimationScale=");
        pw.print(mWindowAnimationScale);
        pw.print(" mTransitionWindowAnimationScale=");
        pw.print(mTransitionAnimationScale);
        pw.print(" mAnimatorDurationScale=");
        pw.println(mAnimatorDurationScale);
        pw.print("  mTraversalScheduled=");
        pw.println(mTraversalScheduled);
        pw.print("  mStartingIconInTransition=");
        pw.print(mStartingIconInTransition);
        pw.print(" mSkipAppTransitionAnimation=");
        pw.println(mSkipAppTransitionAnimation);
        pw.println("  mLayoutToAnim:");
        mAppTransition.dump(pw);
    }
}
Also used : IRemoteCallback(android.os.IRemoteCallback) Point(android.graphics.Point)

Example 20 with IRemoteCallback

use of android.os.IRemoteCallback in project platform_frameworks_base by android.

the class EphemeralResolverService method onBind.

@Override
public final IBinder onBind(Intent intent) {
    return new IEphemeralResolver.Stub() {

        @Override
        public void getEphemeralResolveInfoList(IRemoteCallback callback, int[] digestPrefix, int prefixMask, int sequence) {
            final Message msg = mHandler.obtainMessage(ServiceHandler.MSG_GET_EPHEMERAL_RESOLVE_INFO, prefixMask, sequence, callback);
            final Bundle data = new Bundle();
            data.putIntArray(EXTRA_PREFIX, digestPrefix);
            msg.setData(data);
            msg.sendToTarget();
        }
    };
}
Also used : IRemoteCallback(android.os.IRemoteCallback) Message(android.os.Message) Bundle(android.os.Bundle)

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