Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80255804 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Update IUidObserver.onUidStateChanged to include procStateSeq.

This procStateSeq is associated with the process state change of
an uid and will help in identifying if network policy rules have been
updated for a process state change.

Bug: 27803922
Test: runtest -c com.android.server.am.ActivityManagerServiceTest
      frameworks-services
Change-Id: Iaab8d004f476b96f28d08c886c7b0a6b585b9fef
parent cac01fea
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ public class ActivityManager {
        }

        @Override
        public void onUidStateChanged(int uid, int procState) {
        public void onUidStateChanged(int uid, int procState, long procStateSeq) {
            mListener.onUidImportance(uid, RunningAppProcessInfo.procStateToImportance(procState));
        }

+6 −1
Original line number Diff line number Diff line
@@ -20,8 +20,13 @@ package android.app;
oneway interface IUidObserver {
    /**
     * General report of a state change of an uid.
     *
     * @param uid The uid for which the state change is being reported.
     * @param procState The updated process state for the uid.
     * @param procStateSeq The sequence no. associated with process state change of the uid,
     *                     see UidRecord.procStateSeq for details.
     */
    void onUidStateChanged(int uid, int procState);
    void onUidStateChanged(int uid, int procState, long procStateSeq);

    /**
     * Report that there are no longer any processes running for a uid.
+2 −1
Original line number Diff line number Diff line
@@ -2839,7 +2839,8 @@ class AlarmManagerService extends SystemService {
    }

    final class UidObserver extends IUidObserver.Stub {
        @Override public void onUidStateChanged(int uid, int procState) throws RemoteException {
        @Override public void onUidStateChanged(int uid, int procState,
                long procStateSeq) throws RemoteException {
        }

        @Override public void onUidGone(int uid, boolean disabled) throws RemoteException {
+3 −1
Original line number Diff line number Diff line
@@ -4368,7 +4368,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                            if (reg.lastProcStates != null) {
                                reg.lastProcStates.put(item.uid, item.processState);
                            }
                            observer.onUidStateChanged(item.uid, item.processState);
                            observer.onUidStateChanged(item.uid, item.processState,
                                    item.procStateSeq);
                        }
                    }
                }
@@ -21480,6 +21481,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        pendingChange.processState = uidRec != null
                ? uidRec.setProcState : ActivityManager.PROCESS_STATE_NONEXISTENT;
        pendingChange.ephemeral = uidRec.ephemeral;
        pendingChange.procStateSeq = uidRec != null ? uidRec.curProcStateSeq : 0;
        // Directly update the power manager, since we sit on top of it and it is critical
        // it be kept in sync (so wake locks will be held as soon as appropriate).
+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ public final class UidRecord {
        int change;
        int processState;
        boolean ephemeral;
        long procStateSeq;
    }

    ChangeItem pendingChange;
Loading