Merge "change thread policy to allow read disk" into main am: 0284610ba7
Original change: https://android-review.googlesource.com/c/platform/build/+/3208534 Change-Id: I1d6d663dad4b214e9c2b3f90be623044cb7c4b56 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -176,6 +176,7 @@ java_library {
|
|||||||
],
|
],
|
||||||
libs: [
|
libs: [
|
||||||
"unsupportedappusage",
|
"unsupportedappusage",
|
||||||
|
"strict_mode_stub",
|
||||||
],
|
],
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"aconfig_storage_file_java",
|
"aconfig_storage_file_java",
|
||||||
@@ -196,6 +197,7 @@ java_library {
|
|||||||
],
|
],
|
||||||
libs: [
|
libs: [
|
||||||
"unsupportedappusage-sdk-none",
|
"unsupportedappusage-sdk-none",
|
||||||
|
"fake_device_config",
|
||||||
],
|
],
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"aconfig_storage_file_java_none",
|
"aconfig_storage_file_java_none",
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package android.aconfig.storage;
|
package android.aconfig.storage;
|
||||||
|
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
import android.compat.annotation.UnsupportedAppUsage;
|
||||||
|
import android.os.StrictMode;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.nio.MappedByteBuffer;
|
import java.nio.MappedByteBuffer;
|
||||||
@@ -42,8 +43,10 @@ public class StorageInternalReader {
|
|||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public StorageInternalReader(String packageName, String packageMapFile, String flagValueFile) {
|
public StorageInternalReader(String packageName, String packageMapFile, String flagValueFile) {
|
||||||
|
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
|
||||||
mPackageTable = PackageTable.fromBytes(mapStorageFile(packageMapFile));
|
mPackageTable = PackageTable.fromBytes(mapStorageFile(packageMapFile));
|
||||||
mFlagValueList = FlagValueList.fromBytes(mapStorageFile(flagValueFile));
|
mFlagValueList = FlagValueList.fromBytes(mapStorageFile(flagValueFile));
|
||||||
|
StrictMode.setThreadPolicy(oldPolicy);
|
||||||
mPackageBooleanStartOffset = getPackageBooleanStartOffset(packageName);
|
mPackageBooleanStartOffset = getPackageBooleanStartOffset(packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,9 +14,21 @@
|
|||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
name: "fake_device_config",
|
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",
|
sdk_version: "none",
|
||||||
system_modules: "core-all-system-modules",
|
system_modules: "core-all-system-modules",
|
||||||
host_supported: true,
|
host_supported: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java_library {
|
||||||
|
name: "strict_mode_stub",
|
||||||
|
srcs: [
|
||||||
|
"src/android/os/StrictMode.java",
|
||||||
|
],
|
||||||
|
sdk_version: "core_current",
|
||||||
|
host_supported: true,
|
||||||
|
}
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* 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 {}
|
||||||
|
}
|
Reference in New Issue
Block a user