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

Commit 7cbc8b84 authored by Felipe Leme's avatar Felipe Leme
Browse files

Added system property to enable MultiuserDeprecationReporter.

That will allow to enable it on user builds.

Test: adb shell dumpsys user --deprecated-calls
Bug: 414326600
Bug: 441537286
Flag: EXEMPT debugging changes

Change-Id: I15625b5671b3ef23f3de621fd98aaa8562f84616
parent ce103a8d
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.Process;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.util.SparseIntArray;

@@ -34,16 +35,20 @@ import java.io.PrintWriter;
 */
final class MultiuserDeprecationReporter {

    private static final String PROP_ENABLE_IT = "fw.user.log_deprecation";
    private static final int PROP_ENABLED = 1;
    private static final int PROP_DEFAULT = -1;

    private final Handler mHandler;

    // TODO(b/414326600): merge arrays below and/or use the proper proto / structure

    // Key is "absolute" uid  / app id (i.e., stripping out the user id part), value is count.
    @Nullable // Only set on debuggable builds
    @Nullable
    private final SparseIntArray mGetMainUserCalls;

    // Key is "absolute" uid  / app id (i.e., stripping out the user id part), value is count.
    @Nullable // Only set on debuggable builds
    @Nullable
    private final SparseIntArray mIsMainUserCalls;

    // Set on demand, Should not be used directly (but through getPackageManagerInternal() instead).
@@ -52,7 +57,8 @@ final class MultiuserDeprecationReporter {

    MultiuserDeprecationReporter(Handler handler) {
        mHandler = handler;
        if (Build.isDebuggable()) {
        if (Build.isDebuggable()
                || SystemProperties.getInt(PROP_ENABLE_IT, PROP_DEFAULT) == PROP_ENABLED) {
            mGetMainUserCalls = new SparseIntArray();
            mIsMainUserCalls = new SparseIntArray();
        } else {