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

Commit 0284610b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "change thread policy to allow read disk" into main

parents a490d1bf f5f59928
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ java_library {
    ],
    libs: [
        "unsupportedappusage",
        "strict_mode_stub",
    ],
    static_libs: [
        "aconfig_storage_file_java",
@@ -196,6 +197,7 @@ java_library {
    ],
    libs: [
        "unsupportedappusage-sdk-none",
        "fake_device_config",
    ],
    static_libs: [
        "aconfig_storage_file_java_none",
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.aconfig.storage;

import android.compat.annotation.UnsupportedAppUsage;
import android.os.StrictMode;

import java.io.Closeable;
import java.nio.MappedByteBuffer;
@@ -42,8 +43,10 @@ public class StorageInternalReader {

    @UnsupportedAppUsage
    public StorageInternalReader(String packageName, String packageMapFile, String flagValueFile) {
        StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
        mPackageTable = PackageTable.fromBytes(mapStorageFile(packageMapFile));
        mFlagValueList = FlagValueList.fromBytes(mapStorageFile(flagValueFile));
        StrictMode.setThreadPolicy(oldPolicy);
        mPackageBooleanStartOffset = getPackageBooleanStartOffset(packageName);
    }

+17 −5
Original line number Diff line number Diff line
@@ -14,9 +14,21 @@

java_library {
    name: "fake_device_config",
	srcs: ["src/**/*.java"],
    srcs: [
        "src/android/util/Log.java",
        "src/android/provider/DeviceConfig.java",
        "src/android/os/StrictMode.java",
    ],
    sdk_version: "none",
    system_modules: "core-all-system-modules",
    host_supported: true,
}

java_library {
    name: "strict_mode_stub",
    srcs: [
        "src/android/os/StrictMode.java",
    ],
    sdk_version: "core_current",
    host_supported: true,
}
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.os;

public class StrictMode {
    public static ThreadPolicy allowThreadDiskReads() {
        throw new UnsupportedOperationException("Stub!");
    }

    public static void setThreadPolicy(final ThreadPolicy policy) {
        throw new UnsupportedOperationException("Stub!");
    }

    public static final class ThreadPolicy {}
}