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

Commit b4fd5ab3 authored by Yisroel Forta's avatar Yisroel Forta
Browse files

Hook up AppStartInfo app provided timestamps

Complete passing from AMS to tracker

Also add cross user check for other AppStartInfo methods

Bug: 325776365
Test: new cts tests
Change-Id: Ied7430051461990ef3737ac5aa7ceb9809f7ead2
parent a90f38ae
Loading
Loading
Loading
Loading
+24 −3
Original line number Diff line number Diff line
@@ -10167,7 +10167,11 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
        final int callingUid = Binder.getCallingUid();
        mProcessList.getAppStartInfoTracker().addStartInfoCompleteListener(listener, callingUid);
        mUserController.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, true,
                ALLOW_NON_FULL, "addApplicationStartInfoCompleteListener", null);
        mProcessList.getAppStartInfoTracker().addStartInfoCompleteListener(listener,
                UserHandle.getUid(userId, UserHandle.getAppId(callingUid)));
    }
@@ -10182,13 +10186,30 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
        final int callingUid = Binder.getCallingUid();
        mProcessList.getAppStartInfoTracker().removeStartInfoCompleteListener(listener, callingUid,
                true);
        mUserController.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, true,
                ALLOW_NON_FULL, "removeApplicationStartInfoCompleteListener", null);
        mProcessList.getAppStartInfoTracker().removeStartInfoCompleteListener(listener,
                UserHandle.getUid(userId, UserHandle.getAppId(callingUid)), true);
    }
    @Override
    public void addStartInfoTimestamp(int key, long timestampNs, int userId) {
        enforceNotIsolatedCaller("addStartInfoTimestamp");
        // For the simplification, we don't support USER_ALL nor USER_CURRENT here.
        if (userId == UserHandle.USER_ALL || userId == UserHandle.USER_CURRENT) {
            throw new IllegalArgumentException("Unsupported userId");
        }
        final int callingUid = Binder.getCallingUid();
        mUserController.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, true,
                ALLOW_NON_FULL, "addStartInfoTimestamp", null);
        final String packageName = Settings.getPackageNameForUid(mContext, callingUid);
        mProcessList.getAppStartInfoTracker().addTimestampToStart(packageName,
                UserHandle.getUid(userId, UserHandle.getAppId(callingUid)), timestampNs, key);
    }
    @Override
+1 −1
Original line number Diff line number Diff line
@@ -464,7 +464,7 @@ public final class AppStartInfoTracker {
        addTimestampToStart(app.info.packageName, app.uid, timeNs, key);
    }

    private void addTimestampToStart(String packageName, int uid, long timeNs, int key) {
    void addTimestampToStart(String packageName, int uid, long timeNs, int key) {
        synchronized (mLock) {
            AppStartInfoContainer container = mData.get(packageName, uid);
            if (container == null) {