Search in sources :

Example 11 with IProcessObserver

use of android.app.IProcessObserver in project cornerstone by Onskreen.

the class ActivityManagerService method dispatchProcessesChanged.

private void dispatchProcessesChanged() {
    int N;
    synchronized (this) {
        N = mPendingProcessChanges.size();
        if (mActiveProcessChanges.length < N) {
            mActiveProcessChanges = new ProcessChangeItem[N];
        }
        mPendingProcessChanges.toArray(mActiveProcessChanges);
        mAvailProcessChanges.addAll(mPendingProcessChanges);
        mPendingProcessChanges.clear();
        if (DEBUG_PROCESS_OBSERVERS)
            Slog.i(TAG, "*** Delivering " + N + " process changes");
    }
    int i = mProcessObservers.beginBroadcast();
    while (i > 0) {
        i--;
        final IProcessObserver observer = mProcessObservers.getBroadcastItem(i);
        if (observer != null) {
            try {
                for (int j = 0; j < N; j++) {
                    ProcessChangeItem item = mActiveProcessChanges[j];
                    if ((item.changes & ProcessChangeItem.CHANGE_ACTIVITIES) != 0) {
                        if (DEBUG_PROCESS_OBSERVERS)
                            Slog.i(TAG, "ACTIVITIES CHANGED pid=" + item.pid + " uid=" + item.uid + ": " + item.foregroundActivities);
                        observer.onForegroundActivitiesChanged(item.pid, item.uid, item.foregroundActivities);
                    }
                    if ((item.changes & ProcessChangeItem.CHANGE_IMPORTANCE) != 0) {
                        if (DEBUG_PROCESS_OBSERVERS)
                            Slog.i(TAG, "IMPORTANCE CHANGED pid=" + item.pid + " uid=" + item.uid + ": " + item.importance);
                        observer.onImportanceChanged(item.pid, item.uid, item.importance);
                    }
                }
            } catch (RemoteException e) {
            }
        }
    }
    mProcessObservers.finishBroadcast();
}
Also used : IProcessObserver(android.app.IProcessObserver) RemoteException(android.os.RemoteException)

Example 12 with IProcessObserver

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

the class ActivityManagerService method dispatchProcessesChanged.

private void dispatchProcessesChanged() {
    int N;
    synchronized (this) {
        N = mPendingProcessChanges.size();
        if (mActiveProcessChanges.length < N) {
            mActiveProcessChanges = new ProcessChangeItem[N];
        }
        mPendingProcessChanges.toArray(mActiveProcessChanges);
        mPendingProcessChanges.clear();
        if (DEBUG_PROCESS_OBSERVERS)
            Slog.i(TAG_PROCESS_OBSERVERS, "*** Delivering " + N + " process changes");
    }
    int i = mProcessObservers.beginBroadcast();
    while (i > 0) {
        i--;
        final IProcessObserver observer = mProcessObservers.getBroadcastItem(i);
        if (observer != null) {
            try {
                for (int j = 0; j < N; j++) {
                    ProcessChangeItem item = mActiveProcessChanges[j];
                    if ((item.changes & ProcessChangeItem.CHANGE_ACTIVITIES) != 0) {
                        if (DEBUG_PROCESS_OBSERVERS)
                            Slog.i(TAG_PROCESS_OBSERVERS, "ACTIVITIES CHANGED pid=" + item.pid + " uid=" + item.uid + ": " + item.foregroundActivities);
                        observer.onForegroundActivitiesChanged(item.pid, item.uid, item.foregroundActivities);
                    }
                    if ((item.changes & ProcessChangeItem.CHANGE_PROCESS_STATE) != 0) {
                        if (DEBUG_PROCESS_OBSERVERS)
                            Slog.i(TAG_PROCESS_OBSERVERS, "PROCSTATE CHANGED pid=" + item.pid + " uid=" + item.uid + ": " + item.processState);
                        observer.onProcessStateChanged(item.pid, item.uid, item.processState);
                    }
                }
            } catch (RemoteException e) {
            }
        }
    }
    mProcessObservers.finishBroadcast();
    synchronized (this) {
        for (int j = 0; j < N; j++) {
            mAvailProcessChanges.add(mActiveProcessChanges[j]);
        }
    }
}
Also used : IProcessObserver(android.app.IProcessObserver) RemoteException(android.os.RemoteException) Point(android.graphics.Point)

Example 13 with IProcessObserver

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

the class ActivityManagerService method dispatchProcessDied.

private void dispatchProcessDied(int pid, int uid) {
    int i = mProcessObservers.beginBroadcast();
    while (i > 0) {
        i--;
        final IProcessObserver observer = mProcessObservers.getBroadcastItem(i);
        if (observer != null) {
            try {
                observer.onProcessDied(pid, uid);
            } catch (RemoteException e) {
            }
        }
    }
    mProcessObservers.finishBroadcast();
}
Also used : IProcessObserver(android.app.IProcessObserver) RemoteException(android.os.RemoteException) Point(android.graphics.Point)

Aggregations

IProcessObserver (android.app.IProcessObserver)13 RemoteException (android.os.RemoteException)9 IActivityManager (android.app.IActivityManager)4 INotificationManager (android.app.INotificationManager)4 Intent (android.content.Intent)4 PackageInfo (android.content.pm.PackageInfo)4 PackageManager (android.content.pm.PackageManager)4 Signature (android.content.pm.Signature)4 Point (android.graphics.Point)4 IConnectivityManager (android.net.IConnectivityManager)4 INetworkManagementEventObserver (android.net.INetworkManagementEventObserver)4 INetworkPolicyListener (android.net.INetworkPolicyListener)4 INetworkStatsService (android.net.INetworkStatsService)4 INetworkManagementService (android.os.INetworkManagementService)4 MockPackageManager (android.test.mock.MockPackageManager)4 TrustedTime (android.util.TrustedTime)4 NetworkPolicyManagerService (com.android.server.net.NetworkPolicyManagerService)4 Capture (org.easymock.Capture)4 IPowerManager (android.os.IPowerManager)1