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

Commit 4f6d292d authored by Felipe Leme's avatar Felipe Leme
Browse files

Add "reset" option to MultiuserDeprecationReporter.

Bug: 414326600
Bug: 418215389
Test: adb shell dumpsys user --deprecated-calls reset

Flag: EXEMPT debugging changes

Change-Id: I15625b5671b3ef23f3de621fd98aaa8562f84642
parent 2f4fc4a6
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;
            }
        }