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

Commit 0709c273 authored by Veena Arvind's avatar Veena Arvind
Browse files

Flag guard network change using aconfig flags.

Bug: 231660348
Test: atest FrameworksServicesTests:RebootEscrowManagerTests && m all_aconfig_declarations && printflags
Change-Id: I78bec5d10434fa4e8e0bf2ea5c6bc5b62b249764
parent f17c2a0b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -235,6 +235,7 @@ java_library_static {
        "dreams_flags_lib",
        "aconfig_new_storage_flags_lib",
        "powerstats_flags_lib",
        "locksettings_flags_lib",
    ],
    javac_shard_size: 50,
    javacflags: [
+11 −0
Original line number Diff line number Diff line
aconfig_declarations {
    name: "locksettings_flags",
    package: "com.android.server.locksettings",
    container: "system",
    srcs: ["*.aconfig"],
}

java_aconfig_library {
    name: "locksettings_flags_lib",
    aconfig_declarations: "locksettings_flags",
}
+3 −8
Original line number Diff line number Diff line
@@ -273,11 +273,6 @@ class RebootEscrowManager {
                    "server_based_ror_enabled", false);
        }

        public boolean waitForInternet() {
            return DeviceConfig.getBoolean(
                    DeviceConfig.NAMESPACE_OTA, "wait_for_internet_ror", false);
        }

        public boolean isNetworkConnected() {
            final ConnectivityManager connectivityManager =
                    mContext.getSystemService(ConnectivityManager.class);
@@ -433,7 +428,7 @@ class RebootEscrowManager {

    /** Wrapper function to set error code serialized through handler, */
    private void setLoadEscrowDataErrorCode(@RebootEscrowErrorCode int value, Handler handler) {
        if (mInjector.waitForInternet()) {
        if (Flags.waitForInternetRor()) {
            mInjector.post(
                    handler,
                    () -> {
@@ -516,7 +511,7 @@ class RebootEscrowManager {
            mWakeLock.acquire(mInjector.getWakeLockTimeoutMillis());
        }

        if (mInjector.waitForInternet()) {
        if (Flags.waitForInternetRor()) {
            // Timeout to stop retrying same as the wake lock timeout.
            mInjector.postDelayed(
                    retryHandler,
@@ -553,7 +548,7 @@ class RebootEscrowManager {
            return;
        }

        if (mInjector.waitForInternet()) {
        if (Flags.waitForInternetRor()) {
            if (mRebootEscrowTimedOut) {
                Slog.w(TAG, "Failed to load reboot escrow data within timeout");
                compareAndSetLoadEscrowDataErrorCode(
+9 −0
Original line number Diff line number Diff line
package: "com.android.server.locksettings"
container: "system"

flag {
     name: "wait_for_internet_ror"
     namespace: "sudo"
     description: "Feature flag to wait for internet connectivity before calling resume on reboot server."
     bug: "231660348"
}
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ android_test {
        "net_flags_lib",
        "CtsVirtualDeviceCommonLib",
        "com_android_server_accessibility_flags_lib",
        "locksettings_flags_lib",
    ],

    libs: [
Loading