Search in sources :

Example 6 with ViewRootImpl

use of android.view.ViewRootImpl in project platform_frameworks_base by android.

the class ActivityThread method handleResumeActivity.

final void handleResumeActivity(IBinder token, boolean clearHide, boolean isForward, boolean reallyResume, int seq, String reason) {
    ActivityClientRecord r = mActivities.get(token);
    if (!checkAndUpdateLifecycleSeq(seq, r, "resumeActivity")) {
        return;
    }
    // If we are getting ready to gc after going to the background, well
    // we are back active so skip it.
    unscheduleGcIdler();
    mSomeActivitiesChanged = true;
    // TODO Push resumeArgs into the activity for consideration
    r = performResumeActivity(token, clearHide, reason);
    if (r != null) {
        final Activity a = r.activity;
        if (localLOGV)
            Slog.v(TAG, "Resume " + r + " started activity: " + a.mStartedActivity + ", hideForNow: " + r.hideForNow + ", finished: " + a.mFinished);
        final int forwardBit = isForward ? WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION : 0;
        // If the window hasn't yet been added to the window manager,
        // and this guy didn't finish itself or start another activity,
        // then go ahead and add the window.
        boolean willBeVisible = !a.mStartedActivity;
        if (!willBeVisible) {
            try {
                willBeVisible = ActivityManagerNative.getDefault().willActivityBeVisible(a.getActivityToken());
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }
        if (r.window == null && !a.mFinished && willBeVisible) {
            r.window = r.activity.getWindow();
            View decor = r.window.getDecorView();
            decor.setVisibility(View.INVISIBLE);
            ViewManager wm = a.getWindowManager();
            WindowManager.LayoutParams l = r.window.getAttributes();
            a.mDecor = decor;
            l.type = WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
            l.softInputMode |= forwardBit;
            if (r.mPreserveWindow) {
                a.mWindowAdded = true;
                r.mPreserveWindow = false;
                // Normally the ViewRoot sets up callbacks with the Activity
                // in addView->ViewRootImpl#setView. If we are instead reusing
                // the decor view we have to notify the view root that the
                // callbacks may have changed.
                ViewRootImpl impl = decor.getViewRootImpl();
                if (impl != null) {
                    impl.notifyChildRebuilt();
                }
            }
            if (a.mVisibleFromClient && !a.mWindowAdded) {
                a.mWindowAdded = true;
                wm.addView(decor, l);
            }
        // If the window has already been added, but during resume
        // we started another activity, then don't yet make the
        // window visible.
        } else if (!willBeVisible) {
            if (localLOGV)
                Slog.v(TAG, "Launch " + r + " mStartedActivity set");
            r.hideForNow = true;
        }
        // Get rid of anything left hanging around.
        cleanUpPendingRemoveWindows(r, false);
        // simply finishing, and we are not starting another activity.
        if (!r.activity.mFinished && willBeVisible && r.activity.mDecor != null && !r.hideForNow) {
            if (r.newConfig != null) {
                performConfigurationChangedForActivity(r, r.newConfig, REPORT_TO_ACTIVITY);
                if (DEBUG_CONFIGURATION)
                    Slog.v(TAG, "Resuming activity " + r.activityInfo.name + " with newConfig " + r.activity.mCurrentConfig);
                r.newConfig = null;
            }
            if (localLOGV)
                Slog.v(TAG, "Resuming " + r + " with isForward=" + isForward);
            WindowManager.LayoutParams l = r.window.getAttributes();
            if ((l.softInputMode & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != forwardBit) {
                l.softInputMode = (l.softInputMode & (~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION)) | forwardBit;
                if (r.activity.mVisibleFromClient) {
                    ViewManager wm = a.getWindowManager();
                    View decor = r.window.getDecorView();
                    wm.updateViewLayout(decor, l);
                }
            }
            r.activity.mVisibleFromServer = true;
            mNumVisibleActivities++;
            if (r.activity.mVisibleFromClient) {
                r.activity.makeVisible();
            }
        }
        if (!r.onlyLocalRequest) {
            r.nextIdle = mNewActivities;
            mNewActivities = r;
            if (localLOGV)
                Slog.v(TAG, "Scheduling idle handler for " + r);
            Looper.myQueue().addIdleHandler(new Idler());
        }
        r.onlyLocalRequest = false;
        // Tell the activity manager we have resumed.
        if (reallyResume) {
            try {
                ActivityManagerNative.getDefault().activityResumed(token);
            } catch (RemoteException ex) {
                throw ex.rethrowFromSystemServer();
            }
        }
    } else {
        // just end this activity.
        try {
            ActivityManagerNative.getDefault().finishActivity(token, Activity.RESULT_CANCELED, null, Activity.DONT_FINISH_TASK_WITH_ACTIVITY);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }
}
Also used : ViewRootImpl(android.view.ViewRootImpl) ViewManager(android.view.ViewManager) RemoteException(android.os.RemoteException) View(android.view.View) WebView(android.webkit.WebView) WindowManager(android.view.WindowManager)

Example 7 with ViewRootImpl

use of android.view.ViewRootImpl in project platform_frameworks_base by android.

the class ActivityTransitionCoordinator method pauseInput.

protected void pauseInput() {
    final View decor = getDecor();
    final ViewRootImpl viewRoot = decor == null ? null : decor.getViewRootImpl();
    if (viewRoot != null) {
        viewRoot.setPausedForTransition(true);
    }
}
Also used : ViewRootImpl(android.view.ViewRootImpl) ImageView(android.widget.ImageView) GhostView(android.view.GhostView) View(android.view.View)

Example 8 with ViewRootImpl

use of android.view.ViewRootImpl in project platform_frameworks_base by android.

the class PasswordEntryKeyboardHelper method sendDownUpKeyEvents.

public void sendDownUpKeyEvents(int keyEventCode) {
    long eventTime = SystemClock.uptimeMillis();
    ViewRootImpl viewRootImpl = mTargetView.getViewRootImpl();
    viewRootImpl.dispatchKeyFromIme(new KeyEvent(eventTime, eventTime, KeyEvent.ACTION_DOWN, keyEventCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE));
    viewRootImpl.dispatchKeyFromIme(new KeyEvent(eventTime, eventTime, KeyEvent.ACTION_UP, keyEventCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE));
}
Also used : ViewRootImpl(android.view.ViewRootImpl) KeyEvent(android.view.KeyEvent)

Example 9 with ViewRootImpl

use of android.view.ViewRootImpl in project XobotOS by xamarin.

the class ZoomButtonsController method getOwnerViewRootImpl.

private ViewRootImpl getOwnerViewRootImpl() {
    View rootViewOfOwner = mOwnerView.getRootView();
    if (rootViewOfOwner == null) {
        return null;
    }
    ViewParent parentOfRootView = rootViewOfOwner.getParent();
    if (parentOfRootView instanceof ViewRootImpl) {
        return (ViewRootImpl) parentOfRootView;
    } else {
        return null;
    }
}
Also used : ViewRootImpl(android.view.ViewRootImpl) ViewParent(android.view.ViewParent) View(android.view.View)

Example 10 with ViewRootImpl

use of android.view.ViewRootImpl in project android_frameworks_base by DirtyUnicorns.

the class ActivityTransitionCoordinator method pauseInput.

protected void pauseInput() {
    final View decor = getDecor();
    final ViewRootImpl viewRoot = decor == null ? null : decor.getViewRootImpl();
    if (viewRoot != null) {
        viewRoot.setPausedForTransition(true);
    }
}
Also used : ViewRootImpl(android.view.ViewRootImpl) ImageView(android.widget.ImageView) GhostView(android.view.GhostView) View(android.view.View)

Aggregations

ViewRootImpl (android.view.ViewRootImpl)51 View (android.view.View)34 KeyEvent (android.view.KeyEvent)18 RemoteView (android.widget.RemoteViews.RemoteView)17 AccessibilityNodeInfo (android.view.accessibility.AccessibilityNodeInfo)11 AccessibilityNodeProvider (android.view.accessibility.AccessibilityNodeProvider)11 GhostView (android.view.GhostView)10 ImageView (android.widget.ImageView)10 Paint (android.graphics.Paint)9 InputMethodManager (android.view.inputmethod.InputMethodManager)6 RemoteException (android.os.RemoteException)5 ViewManager (android.view.ViewManager)5 WindowManager (android.view.WindowManager)5 WebView (android.webkit.WebView)5 DecorView (com.android.internal.policy.DecorView)4 Point (android.graphics.Point)2 Display (android.view.Display)2 Activity (android.app.Activity)1 Picture (android.graphics.Picture)1 Rect (android.graphics.Rect)1