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

Commit 13e71c2f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add "reset" option to MultiuserDeprecationReporter." into main

parents 3612aa75 4f6d292d
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@ final class MultiuserDeprecationReporter {
        } else {
            mGetMainUserCalls = null;
            mIsMainUserCalls = null;

        }
    }

@@ -126,6 +125,21 @@ final class MultiuserDeprecationReporter {
        }
    }

    // TODO(b/414326600): add unit tests
    void reset(PrintWriter pw) {
        // TODO(b/414326600): should reset in the mHandler thread (as its state is written in that
        // thread), but it would require blocking the caller until it's done

        if (mGetMainUserCalls != null) {
            mGetMainUserCalls.clear();
        }
        if (mIsMainUserCalls != null) {
            mIsMainUserCalls.clear();
        }

        pw.println("Reset");
    }

    /** Retrieves the internal package manager interface. */
    private PackageManagerInternal getPackageManagerInternal() {
        // Don't need to synchronize; worst-case scenario LocalServices will be called twice.
+5 −1
Original line number Diff line number Diff line
@@ -8053,7 +8053,11 @@ public class UserManagerService extends IUserManager.Stub {
                    mUserVisibilityMediator.dump(pw, args);
                    return;
                case "--deprecated-calls":
                    if (args.length > 1 && args[1].equals("reset")) {
                        mDeprecationReporter.reset(pw);
                    } else {
                        mDeprecationReporter.dump(pw);
                    }
                    return;
            }
        }