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

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

Merge "Add flag to control the throttle duration" into udc-dev

parents 86e2b60c 17d232d8
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ public class RescueParty {
    static final String NAMESPACE_TO_PACKAGE_MAPPING_FLAG =
            "namespace_to_package_mapping";
    @VisibleForTesting
    static final long FACTORY_RESET_THROTTLE_DURATION_MS = TimeUnit.MINUTES.toMillis(10);
    static final long DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN = 10;

    private static final String NAME = "rescue-party-observer";

@@ -117,6 +117,8 @@ public class RescueParty {
            "persist.device_config.configuration.disable_rescue_party";
    private static final String PROP_DISABLE_FACTORY_RESET_FLAG =
            "persist.device_config.configuration.disable_rescue_party_factory_reset";
    private static final String PROP_THROTTLE_DURATION_MIN_FLAG =
            "persist.device_config.configuration.rescue_party_throttle_duration_min";

    private static final int PERSISTENT_MASK = ApplicationInfo.FLAG_PERSISTENT
            | ApplicationInfo.FLAG_SYSTEM;
@@ -722,7 +724,9 @@ public class RescueParty {
        private boolean shouldThrottleReboot() {
            Long lastResetTime = SystemProperties.getLong(PROP_LAST_FACTORY_RESET_TIME_MS, 0);
            long now = System.currentTimeMillis();
            return now < lastResetTime + FACTORY_RESET_THROTTLE_DURATION_MS;
            long throttleDurationMin = SystemProperties.getLong(PROP_THROTTLE_DURATION_MIN_FLAG,
                    DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN);
            return now < lastResetTime + TimeUnit.MINUTES.toMillis(throttleDurationMin);
        }

        private boolean isPersistentSystemApp(@NonNull String packageName) {