Search in sources :

Example 11 with StatusBarManagerInternal

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

the class PhoneWindowManager method launchAssistAction.

private void launchAssistAction(String hint, int deviceId) {
    sendCloseSystemWindows(SYSTEM_DIALOG_REASON_ASSIST);
    if (!isUserSetupComplete()) {
        // Disable opening assist window during setup
        return;
    }
    Bundle args = null;
    if (deviceId > Integer.MIN_VALUE) {
        args = new Bundle();
        args.putInt(Intent.EXTRA_ASSIST_INPUT_DEVICE_ID, deviceId);
    }
    if ((mContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_TELEVISION) {
        // On TV, use legacy handling until assistants are implemented in the proper way.
        ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)).launchLegacyAssist(hint, UserHandle.myUserId(), args);
    } else {
        if (hint != null) {
            if (args == null) {
                args = new Bundle();
            }
            args.putBoolean(hint, true);
        }
        StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
        if (statusbar != null) {
            statusbar.startAssist(args);
        }
    }
}
Also used : StatusBarManagerInternal(com.android.server.statusbar.StatusBarManagerInternal) SearchManager(android.app.SearchManager) Bundle(android.os.Bundle)

Example 12 with StatusBarManagerInternal

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

the class PhoneWindowManager method showRecentApps.

private void showRecentApps(boolean triggeredFromAltTab, boolean fromHome) {
    if (mOmniSwitchRecents) {
        if (fromHome) {
            Intent showIntent = new Intent(DuUtils.ACTION_RESTORE_HOME_STACK);
            mContext.sendBroadcastAsUser(showIntent, UserHandle.CURRENT);
        } else {
            Intent showIntent = new Intent(DuUtils.ACTION_TOGGLE_OVERLAY);
            mContext.sendBroadcastAsUser(showIntent, UserHandle.CURRENT);
        }
    } else {
        // preloading no longer needs to be canceled
        mPreloadedRecentApps = false;
        StatusBarManagerInternal statusbar = getStatusBarManagerInternal();
        if (statusbar != null) {
            statusbar.showRecentApps(triggeredFromAltTab, fromHome);
        }
    }
}
Also used : StatusBarManagerInternal(com.android.server.statusbar.StatusBarManagerInternal) Intent(android.content.Intent) RecognizerIntent(android.speech.RecognizerIntent)

Example 13 with StatusBarManagerInternal

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

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 14 with StatusBarManagerInternal

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

the class GestureLauncherService method handleCameraLaunchGesture.

/**
     * @return true if camera was launched, false otherwise.
     */
private boolean handleCameraLaunchGesture(boolean useWakelock, int source) {
    boolean userSetupComplete = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0;
    if (!userSetupComplete) {
        if (DBG)
            Slog.d(TAG, String.format("userSetupComplete = %s, ignoring camera launch gesture.", userSetupComplete));
        return false;
    }
    if (DBG)
        Slog.d(TAG, String.format("userSetupComplete = %s, performing camera launch gesture.", userSetupComplete));
    if (useWakelock) {
        // Make sure we don't sleep too early
        mWakeLock.acquire(500L);
    }
    StatusBarManagerInternal service = LocalServices.getService(StatusBarManagerInternal.class);
    service.onCameraLaunchGestureDetected(source);
    return true;
}
Also used : StatusBarManagerInternal(com.android.server.statusbar.StatusBarManagerInternal)

Example 15 with StatusBarManagerInternal

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

the class GestureLauncherService method handleCameraLaunchGesture.

/**
     * @return true if camera was launched, false otherwise.
     */
private boolean handleCameraLaunchGesture(boolean useWakelock, int source) {
    boolean userSetupComplete = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0;
    if (!userSetupComplete) {
        if (DBG)
            Slog.d(TAG, String.format("userSetupComplete = %s, ignoring camera launch gesture.", userSetupComplete));
        return false;
    }
    if (DBG)
        Slog.d(TAG, String.format("userSetupComplete = %s, performing camera launch gesture.", userSetupComplete));
    if (useWakelock) {
        // Make sure we don't sleep too early
        mWakeLock.acquire(500L);
    }
    StatusBarManagerInternal service = LocalServices.getService(StatusBarManagerInternal.class);
    service.onCameraLaunchGestureDetected(source);
    return true;
}
Also used : 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