Search in sources :

Example 86 with IActivityManager

use of android.app.IActivityManager in project android_frameworks_base by ResurrectionRemix.

the class OverlayManagerService method updateSelectedAssets.

private void updateSelectedAssets(final int userId, List<String> targetPackageNames) {
    final PackageManagerInternal pm = LocalServices.getService(PackageManagerInternal.class);
    final boolean updateFrameworkRes = targetPackageNames.contains("android");
    if (updateFrameworkRes) {
        targetPackageNames = pm.getTargetPackageNames(userId);
    }
    final Map<String, String[]> allPaths = new ArrayMap<>(targetPackageNames.size());
    synchronized (mLock) {
        final List<String> frameworkPaths = mImpl.onGetEnabledOverlayPaths("android", userId);
        for (final String packageName : targetPackageNames) {
            final List<String> paths = new ArrayList<>();
            paths.addAll(frameworkPaths);
            if (!"android".equals(packageName)) {
                paths.addAll(mImpl.onGetEnabledOverlayPaths(packageName, userId));
            }
            allPaths.put(packageName, paths.isEmpty() ? null : paths.toArray(new String[paths.size()]));
        }
    }
    for (String packageName : targetPackageNames) {
        pm.setResourceDirs(userId, packageName, allPaths.get(packageName));
    }
    final IActivityManager am = ActivityManagerNative.getDefault();
    try {
        am.updateAssets(userId, targetPackageNames);
    } catch (RemoteException e) {
    // Intentionally left empty.
    }
}
Also used : ArrayList(java.util.ArrayList) PackageManagerInternal(android.content.pm.PackageManagerInternal) ArrayMap(android.util.ArrayMap) RemoteException(android.os.RemoteException) IActivityManager(android.app.IActivityManager)

Example 87 with IActivityManager

use of android.app.IActivityManager in project android_frameworks_base by ResurrectionRemix.

the class UserManagerService method runList.

private int runList(PrintWriter pw) throws RemoteException {
    final IActivityManager am = ActivityManagerNative.getDefault();
    final List<UserInfo> users = getUsers(false);
    if (users == null) {
        pw.println("Error: couldn't get users");
        return 1;
    } else {
        pw.println("Users:");
        for (int i = 0; i < users.size(); i++) {
            String running = am.isUserRunning(users.get(i).id, 0) ? " running" : "";
            pw.println("\t" + users.get(i).toString() + running);
        }
        return 0;
    }
}
Also used : UserInfo(android.content.pm.UserInfo) IActivityManager(android.app.IActivityManager)

Example 88 with IActivityManager

use of android.app.IActivityManager in project android_frameworks_base by DirtyUnicorns.

the class LocalePicker method updateLocales.

/**
     * Requests the system to update the list of system locales.
     * Note that the system looks halted for a while during the Locale migration,
     * so the caller need to take care of it.
     */
public static void updateLocales(LocaleList locales) {
    try {
        final IActivityManager am = ActivityManagerNative.getDefault();
        final Configuration config = am.getConfiguration();
        config.setLocales(locales);
        config.userSetLocale = true;
        am.updatePersistentConfiguration(config);
        // Trigger the dirty bit for the Settings Provider.
        BackupManager.dataChanged("com.android.providers.settings");
    } catch (RemoteException e) {
    // Intentionally left blank
    }
}
Also used : Configuration(android.content.res.Configuration) RemoteException(android.os.RemoteException) IActivityManager(android.app.IActivityManager)

Example 89 with IActivityManager

use of android.app.IActivityManager in project android_frameworks_base by ResurrectionRemix.

the class StrictMode method dropboxViolationAsync.

/**
     * In the common case, as set by conditionallyEnableDebugLogging,
     * we're just dropboxing any violations but not showing a dialog,
     * not loggging, and not killing the process.  In these cases we
     * don't need to do a synchronous call to the ActivityManager.
     * This is used by both per-thread and vm-wide violations when
     * applicable.
     */
private static void dropboxViolationAsync(final int violationMaskSubset, final ViolationInfo info) {
    int outstanding = sDropboxCallsInFlight.incrementAndGet();
    if (outstanding > 20) {
        // What's going on?  Let's not make make the situation
        // worse and just not log.
        sDropboxCallsInFlight.decrementAndGet();
        return;
    }
    if (LOG_V)
        Log.d(TAG, "Dropboxing async; in-flight=" + outstanding);
    new Thread("callActivityManagerForStrictModeDropbox") {

        public void run() {
            Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
            try {
                IActivityManager am = ActivityManagerNative.getDefault();
                if (am == null) {
                    Log.d(TAG, "No activity manager; failed to Dropbox violation.");
                } else {
                    am.handleApplicationStrictModeViolation(RuntimeInit.getApplicationObject(), violationMaskSubset, info);
                }
            } catch (RemoteException e) {
                if (e instanceof DeadObjectException) {
                // System process is dead; ignore
                } else {
                    Log.e(TAG, "RemoteException handling StrictMode violation", e);
                }
            }
            int outstanding = sDropboxCallsInFlight.decrementAndGet();
            if (LOG_V)
                Log.d(TAG, "Dropbox complete; in-flight=" + outstanding);
        }
    }.start();
}
Also used : ActivityThread(android.app.ActivityThread) IActivityManager(android.app.IActivityManager)

Example 90 with IActivityManager

use of android.app.IActivityManager in project android_frameworks_base by crdroidandroid.

the class PhoneStatusBar method handleLongPressBackRecents.

/**
     * This handles long-press of both back and recents.  They are
     * handled together to capture them both being long-pressed
     * at the same time to exit screen pinning (lock task).
     *
     * When accessibility mode is on, only a long-press from recents
     * is required to exit.
     *
     * In all other circumstances we try to pass through long-press events
     * for Back, so that apps can still use it.  Which can be from two things.
     * 1) Not currently in screen pinning (lock task).
     * 2) Back is long-pressed without recents.
     */
private boolean handleLongPressBackRecents(View v) {
    try {
        boolean sendBackLongPress = false;
        IActivityManager activityManager = ActivityManagerNative.getDefault();
        boolean touchExplorationEnabled = mAccessibilityManager.isTouchExplorationEnabled();
        boolean inLockTaskMode = activityManager.isInLockTaskMode();
        if (inLockTaskMode && !touchExplorationEnabled) {
            long time = System.currentTimeMillis();
            // long-pressed 'together'
            if ((time - mLastLockToAppLongPress) < LOCK_TO_APP_GESTURE_TOLERENCE) {
                activityManager.stopLockTaskMode();
                return true;
            } else if (v.getId() == R.id.back) {
                // If we aren't pressing recents right now then they presses
                // won't be together, so send the standard long-press action.
                sendBackLongPress = true;
            }
            mLastLockToAppLongPress = time;
        } else {
            // If this is back still need to handle sending the long-press event.
            if (v.getId() == R.id.back) {
                sendBackLongPress = true;
            } else if (touchExplorationEnabled && inLockTaskMode) {
                // When in accessibility mode a long press that is recents (not back)
                // should stop lock task.
                activityManager.stopLockTaskMode();
                return true;
            } else if (v.getId() == R.id.recent_apps) {
                return handleLongPressRecents();
            }
        }
        if (sendBackLongPress) {
            KeyButtonView keyButtonView = (KeyButtonView) v;
            keyButtonView.sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_LONG_PRESS);
            keyButtonView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
            return true;
        }
    } catch (RemoteException e) {
        Log.d(TAG, "Unable to reach activity manager", e);
    }
    return false;
}
Also used : KeyButtonView(com.android.systemui.statusbar.policy.KeyButtonView) RemoteException(android.os.RemoteException) IActivityManager(android.app.IActivityManager)

Aggregations

IActivityManager (android.app.IActivityManager)114 RemoteException (android.os.RemoteException)95 Intent (android.content.Intent)23 IBinder (android.os.IBinder)20 Configuration (android.content.res.Configuration)15 UserHandle (android.os.UserHandle)14 ContentProviderHolder (android.app.IActivityManager.ContentProviderHolder)11 IContentProvider (android.content.IContentProvider)11 Binder (android.os.Binder)11 ActivityOptions (android.app.ActivityOptions)10 ActivityThread (android.app.ActivityThread)9 IntentSender (android.content.IntentSender)9 Context (android.content.Context)8 Point (android.graphics.Point)7 SpannableString (android.text.SpannableString)7 BroadcastReceiver (android.content.BroadcastReceiver)6 ComponentName (android.content.ComponentName)6 IMountService (android.os.storage.IMountService)6 IMountShutdownObserver (android.os.storage.IMountShutdownObserver)6 Locale (java.util.Locale)6