Search in sources :

Example 1 with StatusBarManagerInternal

use of com.android.server.statusbar.StatusBarManagerInternal in project platform_frameworks_base by android.

the class ActivityManagerService method startLockTaskModeLocked.

void startLockTaskModeLocked(TaskRecord task) {
    if (DEBUG_LOCKTASK)
        Slog.w(TAG_LOCKTASK, "startLockTaskModeLocked: " + task);
    if (task.mLockTaskAuth == LOCK_TASK_AUTH_DONT_LOCK) {
        return;
    }
    // isSystemInitiated is used to distinguish between locked and pinned mode, as pinned mode
    // is initiated by system after the pinning request was shown and locked mode is initiated
    // by an authorized app directly
    final int callingUid = Binder.getCallingUid();
    boolean isSystemInitiated = callingUid == Process.SYSTEM_UID;
    long ident = Binder.clearCallingIdentity();
    try {
        if (!isSystemInitiated) {
            task.mLockTaskUid = callingUid;
            if (task.mLockTaskAuth == LOCK_TASK_AUTH_PINNABLE) {
                // startLockTask() called by app and task mode is lockTaskModeDefault.
                if (DEBUG_LOCKTASK)
                    Slog.w(TAG_LOCKTASK, "Mode default, asking user");
                StatusBarManagerInternal statusBarManager = LocalServices.getService(StatusBarManagerInternal.class);
                if (statusBarManager != null) {
                    statusBarManager.showScreenPinningRequest(task.taskId);
                }
                return;
            }
            final ActivityStack stack = mStackSupervisor.getFocusedStack();
            if (stack == null || task != stack.topTask()) {
                throw new IllegalArgumentException("Invalid task, not in foreground");
            }
        }
        if (DEBUG_LOCKTASK)
            Slog.w(TAG_LOCKTASK, isSystemInitiated ? "Locking pinned" : "Locking fully");
        mStackSupervisor.setLockTaskModeLocked(task, isSystemInitiated ? ActivityManager.LOCK_TASK_MODE_PINNED : ActivityManager.LOCK_TASK_MODE_LOCKED, "startLockTask", true);
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
}
Also used : StatusBarManagerInternal(com.android.server.statusbar.StatusBarManagerInternal) Point(android.graphics.Point)

Example 2 with StatusBarManagerInternal

use of com.android.server.statusbar.StatusBarManagerInternal in project platform_frameworks_base by android.

the class PhoneWindowManager method preloadRecentApps.

private void preloadRecentApps() {
    mPreloadedRecentApps = true;
    StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
    if (statusbar != null) {
        statusbar.preloadRecentApps();
    }
}
Also used : StatusBarManagerInternal(com.android.server.statusbar.StatusBarManagerInternal)

Example 3 with StatusBarManagerInternal

use of com.android.server.statusbar.StatusBarManagerInternal in project platform_frameworks_base by android.

the class PhoneWindowManager method toggleRecentApps.

private void toggleRecentApps() {
    // preloading no longer needs to be canceled
    mPreloadedRecentApps = false;
    StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
    if (statusbar != null) {
        statusbar.toggleRecentApps();
    }
}
Also used : StatusBarManagerInternal(com.android.server.statusbar.StatusBarManagerInternal)

Example 4 with StatusBarManagerInternal

use of com.android.server.statusbar.StatusBarManagerInternal in project platform_frameworks_base by android.

the class PhoneWindowManager method setCurrentUserLw.

@Override
public void setCurrentUserLw(int newUserId) {
    mCurrentUserId = newUserId;
    if (mKeyguardDelegate != null) {
        mKeyguardDelegate.setCurrentUser(newUserId);
    }
    StatusBarManagerInternal statusBar = getStatusBarManagerInternal();
    if (statusBar != null) {
        statusBar.setCurrentUser(newUserId);
    }
    setLastInputMethodWindowLw(null, null);
}
Also used : StatusBarManagerInternal(com.android.server.statusbar.StatusBarManagerInternal)

Example 5 with StatusBarManagerInternal

use of com.android.server.statusbar.StatusBarManagerInternal in project android_frameworks_base by ResurrectionRemix.

the class PhoneWindowManager method updateSystemUiVisibilityLw.

private int updateSystemUiVisibilityLw() {
    // If there is no window focused, there will be nobody to handle the events
    // anyway, so just hang on in whatever state we're in until things settle down.
    WindowState winCandidate = mFocusedWindow != null ? mFocusedWindow : mTopFullscreenOpaqueWindowState;
    if (winCandidate == null) {
        return 0;
    }
    if (winCandidate.getAttrs().token == mImmersiveModeConfirmation.getWindowToken()) {
        // The immersive mode confirmation should never affect the system bar visibility,
        // otherwise it will unhide the navigation bar and hide itself.
        winCandidate = isStatusBarKeyguard() ? mStatusBar : mTopFullscreenOpaqueWindowState;
        if (winCandidate == null) {
            return 0;
        }
    }
    final WindowState win = winCandidate;
    if ((win.getAttrs().privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 && mHideLockScreen == true) {
        // will quickly lose focus once it correctly gets hidden.
        return 0;
    }
    int tmpVisibility = WindowManagerPolicyControl.getSystemUiVisibility(win, null) & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags;
    boolean wasCleared = mClearedBecauseOfForceShow;
    if (mForcingShowNavBar && win.getSurfaceLayer() < mForcingShowNavBarLayer) {
        tmpVisibility &= ~WindowManagerPolicyControl.adjustClearableFlags(win, View.SYSTEM_UI_CLEARABLE_FLAGS);
        mClearedBecauseOfForceShow = true;
    } else {
        mClearedBecauseOfForceShow = false;
    }
    // transient state have more priority than translucent (why?) and cause bad UX
    if (wasCleared && !mClearedBecauseOfForceShow && (tmpVisibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0) {
        mNavigationBarController.showTransient();
        tmpVisibility |= View.NAVIGATION_BAR_TRANSIENT;
        mWindowManagerFuncs.addSystemUIVisibilityFlag(View.NAVIGATION_BAR_TRANSIENT);
    }
    boolean topWindowWasKeyguard = mTopWindowIsKeyguard;
    mTopWindowIsKeyguard = (win.getAttrs().privateFlags & PRIVATE_FLAG_KEYGUARD) != 0;
    if (topWindowWasKeyguard && !mTopWindowIsKeyguard && (tmpVisibility & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0) {
        mStatusBarController.showTransient();
        tmpVisibility |= View.STATUS_BAR_TRANSIENT;
        mWindowManagerFuncs.addSystemUIVisibilityFlag(View.STATUS_BAR_TRANSIENT);
    }
    final int fullscreenVisibility = updateLightStatusBarLw(0, /* vis */
    mTopFullscreenOpaqueWindowState, mTopFullscreenOpaqueOrDimmingWindowState);
    final int dockedVisibility = updateLightStatusBarLw(0, /* vis */
    mTopDockedOpaqueWindowState, mTopDockedOpaqueOrDimmingWindowState);
    mWindowManagerFuncs.getStackBounds(HOME_STACK_ID, mNonDockedStackBounds);
    mWindowManagerFuncs.getStackBounds(DOCKED_STACK_ID, mDockedStackBounds);
    final int visibility = updateSystemBarsLw(win, mLastSystemUiFlags, tmpVisibility);
    final int diff = visibility ^ mLastSystemUiFlags;
    final int fullscreenDiff = fullscreenVisibility ^ mLastFullscreenStackSysUiFlags;
    final int dockedDiff = dockedVisibility ^ mLastDockedStackSysUiFlags;
    final boolean needsMenu = win.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
    if (diff == 0 && fullscreenDiff == 0 && dockedDiff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == win.getAppToken() && mLastNonDockedStackBounds.equals(mNonDockedStackBounds) && mLastDockedStackBounds.equals(mDockedStackBounds)) {
        return 0;
    }
    mLastSystemUiFlags = visibility;
    mLastFullscreenStackSysUiFlags = fullscreenVisibility;
    mLastDockedStackSysUiFlags = dockedVisibility;
    mLastFocusNeedsMenu = needsMenu;
    mFocusedApp = win.getAppToken();
    final Rect fullscreenStackBounds = new Rect(mNonDockedStackBounds);
    final Rect dockedStackBounds = new Rect(mDockedStackBounds);
    mHandler.post(new Runnable() {

        @Override
        public void run() {
            StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
            if (statusbar != null) {
                statusbar.setSystemUiVisibility(visibility, fullscreenVisibility, dockedVisibility, 0xffffffff, fullscreenStackBounds, dockedStackBounds, win.toString());
                statusbar.topAppWindowChanged(needsMenu);
            }
        }
    });
    return diff;
}
Also used : Rect(android.graphics.Rect) StatusBarManagerInternal(com.android.server.statusbar.StatusBarManagerInternal)

Aggregations

StatusBarManagerInternal (com.android.server.statusbar.StatusBarManagerInternal)31 SearchManager (android.app.SearchManager)3 Rect (android.graphics.Rect)3 Bundle (android.os.Bundle)3 Point (android.graphics.Point)2 Intent (android.content.Intent)1 RecognizerIntent (android.speech.RecognizerIntent)1