Search in sources :

Example 86 with IBinder

use of android.os.IBinder in project XobotOS by xamarin.

the class AccessibilityManager method getInstance.

/**
     * Get an AccessibilityManager instance (create one if necessary).
     *
     * @hide
     */
public static AccessibilityManager getInstance(Context context) {
    synchronized (sInstanceSync) {
        if (sInstance == null) {
            IBinder iBinder = ServiceManager.getService(Context.ACCESSIBILITY_SERVICE);
            IAccessibilityManager service = IAccessibilityManager.Stub.asInterface(iBinder);
            sInstance = new AccessibilityManager(context, service);
        }
    }
    return sInstance;
}
Also used : IBinder(android.os.IBinder)

Example 87 with IBinder

use of android.os.IBinder in project XobotOS by xamarin.

the class InputMethodManager method getInstance.

/**
     * Internally, the input method manager can't be context-dependent, so
     * we have this here for the places that need it.
     * @hide
     */
public static InputMethodManager getInstance(Looper mainLooper) {
    synchronized (mInstanceSync) {
        if (mInstance != null) {
            return mInstance;
        }
        IBinder b = ServiceManager.getService(Context.INPUT_METHOD_SERVICE);
        IInputMethodManager service = IInputMethodManager.Stub.asInterface(b);
        mInstance = new InputMethodManager(service, mainLooper);
    }
    return mInstance;
}
Also used : IBinder(android.os.IBinder) IInputMethodManager(com.android.internal.view.IInputMethodManager) IInputMethodManager(com.android.internal.view.IInputMethodManager)

Example 88 with IBinder

use of android.os.IBinder in project XobotOS by xamarin.

the class ActivityThread method handleRelaunchActivity.

private void handleRelaunchActivity(ActivityClientRecord tmp) {
    // If we are getting ready to gc after going to the background, well
    // we are back active so skip it.
    unscheduleGcIdler();
    Configuration changedConfig = null;
    int configChanges = 0;
    // had taken a more recent version.
    synchronized (mPackages) {
        int N = mRelaunchingActivities.size();
        IBinder token = tmp.token;
        tmp = null;
        for (int i = 0; i < N; i++) {
            ActivityClientRecord r = mRelaunchingActivities.get(i);
            if (r.token == token) {
                tmp = r;
                configChanges |= tmp.pendingConfigChanges;
                mRelaunchingActivities.remove(i);
                i--;
                N--;
            }
        }
        if (tmp == null) {
            if (DEBUG_CONFIGURATION)
                Slog.v(TAG, "Abort, activity not relaunching!");
            return;
        }
        if (DEBUG_CONFIGURATION)
            Slog.v(TAG, "Relaunching activity " + tmp.token + " with configChanges=0x" + Integer.toHexString(configChanges));
        if (mPendingConfiguration != null) {
            changedConfig = mPendingConfiguration;
            mPendingConfiguration = null;
        }
    }
    if (tmp.createdConfig != null) {
        // may have pending.
        if (mConfiguration == null || (tmp.createdConfig.isOtherSeqNewer(mConfiguration) && mConfiguration.diff(tmp.createdConfig) != 0)) {
            if (changedConfig == null || tmp.createdConfig.isOtherSeqNewer(changedConfig)) {
                changedConfig = tmp.createdConfig;
            }
        }
    }
    if (DEBUG_CONFIGURATION)
        Slog.v(TAG, "Relaunching activity " + tmp.token + ": changedConfig=" + changedConfig);
    // If there was a pending configuration change, execute it first.
    if (changedConfig != null) {
        handleConfigurationChanged(changedConfig, null);
    }
    ActivityClientRecord r = mActivities.get(tmp.token);
    if (DEBUG_CONFIGURATION)
        Slog.v(TAG, "Handling relaunch of " + r);
    if (r == null) {
        return;
    }
    r.activity.mConfigChangeFlags |= configChanges;
    r.onlyLocalRequest = tmp.onlyLocalRequest;
    Intent currentIntent = r.activity.mIntent;
    r.activity.mChangingConfigurations = true;
    // Need to ensure state is saved.
    if (!r.paused) {
        performPauseActivity(r.token, false, r.isPreHoneycomb());
    }
    if (r.state == null && !r.stopped && !r.isPreHoneycomb()) {
        r.state = new Bundle();
        r.state.setAllowFds(false);
        mInstrumentation.callActivityOnSaveInstanceState(r.activity, r.state);
    }
    handleDestroyActivity(r.token, false, configChanges, true);
    r.activity = null;
    r.window = null;
    r.hideForNow = false;
    r.nextIdle = null;
    // Merge any pending results and pending intents; don't just replace them
    if (tmp.pendingResults != null) {
        if (r.pendingResults == null) {
            r.pendingResults = tmp.pendingResults;
        } else {
            r.pendingResults.addAll(tmp.pendingResults);
        }
    }
    if (tmp.pendingIntents != null) {
        if (r.pendingIntents == null) {
            r.pendingIntents = tmp.pendingIntents;
        } else {
            r.pendingIntents.addAll(tmp.pendingIntents);
        }
    }
    r.startsNotResumed = tmp.startsNotResumed;
    handleLaunchActivity(r, currentIntent);
}
Also used : IBinder(android.os.IBinder) Configuration(android.content.res.Configuration) Bundle(android.os.Bundle) Intent(android.content.Intent)

Example 89 with IBinder

use of android.os.IBinder in project XobotOS by xamarin.

the class ActivityThread method cleanUpPendingRemoveWindows.

final void cleanUpPendingRemoveWindows(ActivityClientRecord r) {
    if (r.mPendingRemoveWindow != null) {
        r.mPendingRemoveWindowManager.removeViewImmediate(r.mPendingRemoveWindow);
        IBinder wtoken = r.mPendingRemoveWindow.getWindowToken();
        if (wtoken != null) {
            WindowManagerImpl.getDefault().closeAll(wtoken, r.activity.getClass().getName(), "Activity");
        }
    }
    r.mPendingRemoveWindow = null;
    r.mPendingRemoveWindowManager = null;
}
Also used : IBinder(android.os.IBinder)

Example 90 with IBinder

use of android.os.IBinder in project XobotOS by xamarin.

the class ActivityThread method handleDestroyActivity.

private void handleDestroyActivity(IBinder token, boolean finishing, int configChanges, boolean getNonConfigInstance) {
    ActivityClientRecord r = performDestroyActivity(token, finishing, configChanges, getNonConfigInstance);
    if (r != null) {
        cleanUpPendingRemoveWindows(r);
        WindowManager wm = r.activity.getWindowManager();
        View v = r.activity.mDecor;
        if (v != null) {
            if (r.activity.mVisibleFromServer) {
                mNumVisibleActivities--;
            }
            IBinder wtoken = v.getWindowToken();
            if (r.activity.mWindowAdded) {
                if (r.onlyLocalRequest) {
                    // Hold off on removing this until the new activity's
                    // window is being added.
                    r.mPendingRemoveWindow = v;
                    r.mPendingRemoveWindowManager = wm;
                } else {
                    wm.removeViewImmediate(v);
                }
            }
            if (wtoken != null && r.mPendingRemoveWindow == null) {
                WindowManagerImpl.getDefault().closeAll(wtoken, r.activity.getClass().getName(), "Activity");
            }
            r.activity.mDecor = null;
        }
        if (r.mPendingRemoveWindow == null) {
            // If we are delaying the removal of the activity window, then
            // we can't clean up all windows here.  Note that we can't do
            // so later either, which means any windows that aren't closed
            // by the app will leak.  Well we try to warning them a lot
            // about leaking windows, because that is a bug, so if they are
            // using this recreate facility then they get to live with leaks.
            WindowManagerImpl.getDefault().closeAll(token, r.activity.getClass().getName(), "Activity");
        }
        // Mocked out contexts won't be participating in the normal
        // process lifecycle, but if we're running with a proper
        // ApplicationContext we need to have it tear down things
        // cleanly.
        Context c = r.activity.getBaseContext();
        if (c instanceof ContextImpl) {
            ((ContextImpl) c).scheduleFinalCleanup(r.activity.getClass().getName(), "Activity");
        }
    }
    if (finishing) {
        try {
            ActivityManagerNative.getDefault().activityDestroyed(token);
        } catch (RemoteException ex) {
        // If the system process has died, it's game over for everyone.
        }
    }
}
Also used : Context(android.content.Context) IBinder(android.os.IBinder) RemoteException(android.os.RemoteException) View(android.view.View) WindowManager(android.view.WindowManager)

Aggregations

IBinder (android.os.IBinder)991 RemoteException (android.os.RemoteException)494 Intent (android.content.Intent)141 ComponentName (android.content.ComponentName)128 ServiceConnection (android.content.ServiceConnection)94 Parcel (android.os.Parcel)91 Point (android.graphics.Point)67 PendingIntent (android.app.PendingIntent)60 IOException (java.io.IOException)53 UserHandle (android.os.UserHandle)50 Bundle (android.os.Bundle)40 Binder (android.os.Binder)37 Message (android.os.Message)37 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)34 AndroidRuntimeException (android.util.AndroidRuntimeException)33 Handler (android.os.Handler)31 ArrayList (java.util.ArrayList)27 IContentProvider (android.content.IContentProvider)25 TransactionTooLargeException (android.os.TransactionTooLargeException)25 OperationResult (android.security.keymaster.OperationResult)25