Search in sources :

Example 16 with IStatusBarService

use of com.android.internal.statusbar.IStatusBarService in project android_frameworks_base by DirtyUnicorns.

the class DevicePolicyManagerService method setStatusBarDisabledInternal.

private boolean setStatusBarDisabledInternal(boolean disabled, int userId) {
    long ident = mInjector.binderClearCallingIdentity();
    try {
        IStatusBarService statusBarService = IStatusBarService.Stub.asInterface(ServiceManager.checkService(Context.STATUS_BAR_SERVICE));
        if (statusBarService != null) {
            int flags1 = disabled ? STATUS_BAR_DISABLE_MASK : StatusBarManager.DISABLE_NONE;
            int flags2 = disabled ? STATUS_BAR_DISABLE2_MASK : StatusBarManager.DISABLE2_NONE;
            statusBarService.disableForUser(flags1, mToken, mContext.getPackageName(), userId);
            statusBarService.disable2ForUser(flags2, mToken, mContext.getPackageName(), userId);
            return true;
        }
    } catch (RemoteException e) {
        Slog.e(LOG_TAG, "Failed to disable the status bar", e);
    } finally {
        mInjector.binderRestoreCallingIdentity(ident);
    }
    return false;
}
Also used : IStatusBarService(com.android.internal.statusbar.IStatusBarService) RemoteException(android.os.RemoteException)

Example 17 with IStatusBarService

use of com.android.internal.statusbar.IStatusBarService in project android_frameworks_base by ResurrectionRemix.

the class InputMethodService method showWindow.

public void showWindow(boolean showInput) {
    if (DEBUG)
        Log.v(TAG, "Showing window: showInput=" + showInput + " mShowInputRequested=" + mShowInputRequested + " mWindowAdded=" + mWindowAdded + " mWindowCreated=" + mWindowCreated + " mWindowVisible=" + mWindowVisible + " mInputStarted=" + mInputStarted + " mShowInputFlags=" + mShowInputFlags);
    if (mInShowWindow) {
        Log.w(TAG, "Re-entrance in to showWindow");
        return;
    }
    try {
        mWindowWasVisible = mWindowVisible;
        mInShowWindow = true;
        showWindowInner(showInput);
    } catch (BadTokenException e) {
        // while there is a DO_SHOW_SOFT_INPUT message in the IIMethodWrapper queue.
        if (DEBUG)
            Log.v(TAG, "BadTokenException: IME is done.");
        mWindowVisible = false;
        mWindowAdded = false;
        // InputMethodManager#showSoftInputFromInputMethod() should always be used instead.
        throw e;
    } finally {
        // TODO: Is it OK to set true when we get BadTokenException?
        mWindowWasVisible = true;
        mInShowWindow = false;
    }
    IStatusBarService statusbar = getStatusBarService();
    int mKeyboardRotationTimeout = Settings.System.getIntForUser(getContentResolver(), Settings.System.KEYBOARD_ROTATION_TIMEOUT, 0, UserHandle.USER_CURRENT_OR_SELF);
    if (mKeyboardRotationTimeout > 0) {
        mHandler.removeCallbacks(restoreAutoRotation);
        if (!mForcedAutoRotate) {
            boolean isAutoRotate = (Settings.System.getIntForUser(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0, UserHandle.USER_CURRENT_OR_SELF) == 1);
            if (!isAutoRotate) {
                try {
                    if (statusbar != null) {
                        statusbar.setAutoRotate(true);
                        mForcedAutoRotate = true;
                    }
                } catch (RemoteException e) {
                    mStatusBarService = null;
                }
            }
        }
    }
}
Also used : IStatusBarService(com.android.internal.statusbar.IStatusBarService) RemoteException(android.os.RemoteException) BadTokenException(android.view.WindowManager.BadTokenException)

Aggregations

RemoteException (android.os.RemoteException)17 IStatusBarService (com.android.internal.statusbar.IStatusBarService)17 IWindowManager (android.view.IWindowManager)8 Intent (android.content.Intent)7 WindowManager (android.view.WindowManager)6 ActivityNotFoundException (android.content.ActivityNotFoundException)5 KeyCharacterMap (android.view.KeyCharacterMap)4 LayoutParams (android.view.WindowManager.LayoutParams)4 IDeviceIdleController (android.os.IDeviceIdleController)3 RecognizerIntent (android.speech.RecognizerIntent)3 IShortcutService (com.android.internal.policy.IShortcutService)3 URISyntaxException (java.net.URISyntaxException)3 SearchManager (android.app.SearchManager)1 ContentResolver (android.content.ContentResolver)1 CameraAccessException (android.hardware.camera2.CameraAccessException)1 AudioManager (android.media.AudioManager)1 ToneGenerator (android.media.ToneGenerator)1 PowerManager (android.os.PowerManager)1 UserHandle (android.os.UserHandle)1 Vibrator (android.os.Vibrator)1