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

Commit 993720fe authored by Yisroel Forta's avatar Yisroel Forta Committed by Android (Google) Code Review
Browse files

Merge "Hook up AppStartInfo app provided timestamps" into main

parents 9b7dab04 b4fd5ab3
Loading
Loading
Loading
Loading
+24 −3
Original line number Diff line number Diff line
@@ -10175,7 +10175,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)));
    }
@@ -10190,13 +10194,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) {