Loading Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -1007,6 +1007,8 @@ filegroup { srcs: [ "core/java/android/os/incremental/IIncrementalService.aidl", "core/java/android/os/incremental/IncrementalNewFileParams.aidl", "core/java/android/os/incremental/IStorageHealthListener.aidl", "core/java/android/os/incremental/StorageHealthCheckParams.aidl", ], path: "core/java", } Loading core/java/android/os/incremental/IIncrementalService.aidl +6 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package android.os.incremental; import android.content.pm.DataLoaderParamsParcel; import android.content.pm.IDataLoaderStatusListener; import android.os.incremental.IncrementalNewFileParams; import android.os.incremental.IStorageHealthListener; import android.os.incremental.StorageHealthCheckParams; /** @hide */ interface IIncrementalService { Loading @@ -34,7 +36,10 @@ interface IIncrementalService { * Opens or creates a storage given a target path and data loader params. Returns the storage ID. */ int openStorage(in @utf8InCpp String path); int createStorage(in @utf8InCpp String path, in DataLoaderParamsParcel params, in IDataLoaderStatusListener listener, int createMode); int createStorage(in @utf8InCpp String path, in DataLoaderParamsParcel params, int createMode, in IDataLoaderStatusListener statusListener, in StorageHealthCheckParams healthCheckParams, in IStorageHealthListener healthListener); int createLinkedStorage(in @utf8InCpp String path, int otherStorageId, int createMode); /** Loading core/java/android/os/incremental/IStorageHealthListener.aidl 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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.incremental; /** @hide */ oneway interface IStorageHealthListener { /** OK status, no pending reads. */ const int HEALTH_STATUS_OK = 0; /* Statuses depend on timeouts defined in StorageHealthCheckParams. */ /** Pending reads detected, waiting for params.blockedTimeoutMs to confirm blocked state. */ const int HEALTH_STATUS_READS_PENDING = 1; /** There are reads pending for params.blockedTimeoutMs, waiting till * params.unhealthyTimeoutMs to confirm unhealthy state. */ const int HEALTH_STATUS_BLOCKED = 2; /** There are reads pending for params.unhealthyTimeoutMs>, * marking storage as unhealthy. */ const int HEALTH_STATUS_UNHEALTHY = 3; /** Health status callback. */ void onHealthStatus(in int storageId, in int status); } core/java/android/os/incremental/IncrementalFileStorages.java +12 −9 Original line number Diff line number Diff line Loading @@ -65,7 +65,9 @@ public final class IncrementalFileStorages { public static IncrementalFileStorages initialize(Context context, @NonNull File stageDir, @NonNull DataLoaderParams dataLoaderParams, @Nullable IDataLoaderStatusListener dataLoaderStatusListener, @Nullable IDataLoaderStatusListener statusListener, @Nullable StorageHealthCheckParams healthCheckParams, @Nullable IStorageHealthListener healthListener, List<InstallationFileParcel> addedFiles) throws IOException { // TODO(b/136132412): sanity check if session should not be incremental IncrementalManager incrementalManager = (IncrementalManager) context.getSystemService( Loading @@ -75,9 +77,9 @@ public final class IncrementalFileStorages { throw new IOException("Failed to obtain incrementalManager."); } final IncrementalFileStorages result = new IncrementalFileStorages(stageDir, incrementalManager, dataLoaderParams, dataLoaderStatusListener); final IncrementalFileStorages result = new IncrementalFileStorages(stageDir, incrementalManager, dataLoaderParams, statusListener, healthCheckParams, healthListener); for (InstallationFileParcel file : addedFiles) { if (file.location == LOCATION_DATA_APP) { try { Loading @@ -100,7 +102,9 @@ public final class IncrementalFileStorages { private IncrementalFileStorages(@NonNull File stageDir, @NonNull IncrementalManager incrementalManager, @NonNull DataLoaderParams dataLoaderParams, @Nullable IDataLoaderStatusListener dataLoaderStatusListener) throws IOException { @Nullable IDataLoaderStatusListener statusListener, @Nullable StorageHealthCheckParams healthCheckParams, @Nullable IStorageHealthListener healthListener) throws IOException { try { mStageDir = stageDir; mIncrementalManager = incrementalManager; Loading @@ -117,10 +121,9 @@ public final class IncrementalFileStorages { mDefaultStorage.bind(stageDir.getAbsolutePath()); } else { mDefaultStorage = mIncrementalManager.createStorage(stageDir.getAbsolutePath(), dataLoaderParams, dataLoaderStatusListener, IncrementalManager.CREATE_MODE_CREATE | IncrementalManager.CREATE_MODE_TEMPORARY_BIND, false); dataLoaderParams, IncrementalManager.CREATE_MODE_CREATE | IncrementalManager.CREATE_MODE_TEMPORARY_BIND, false, statusListener, healthCheckParams, healthListener); if (mDefaultStorage == null) { throw new IOException( "Couldn't create incremental storage at " + stageDir); Loading core/java/android/os/incremental/IncrementalManager.java +7 −3 Original line number Diff line number Diff line Loading @@ -110,11 +110,15 @@ public final class IncrementalManager { */ @Nullable public IncrementalStorage createStorage(@NonNull String path, @NonNull DataLoaderParams params, @Nullable IDataLoaderStatusListener listener, @NonNull DataLoaderParams params, @CreateMode int createMode, boolean autoStartDataLoader) { boolean autoStartDataLoader, @Nullable IDataLoaderStatusListener statusListener, @Nullable StorageHealthCheckParams healthCheckParams, @Nullable IStorageHealthListener healthListener) { try { final int id = mService.createStorage(path, params.getData(), listener, createMode); final int id = mService.createStorage(path, params.getData(), createMode, statusListener, healthCheckParams, healthListener); if (id < 0) { return null; } Loading Loading
Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -1007,6 +1007,8 @@ filegroup { srcs: [ "core/java/android/os/incremental/IIncrementalService.aidl", "core/java/android/os/incremental/IncrementalNewFileParams.aidl", "core/java/android/os/incremental/IStorageHealthListener.aidl", "core/java/android/os/incremental/StorageHealthCheckParams.aidl", ], path: "core/java", } Loading
core/java/android/os/incremental/IIncrementalService.aidl +6 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package android.os.incremental; import android.content.pm.DataLoaderParamsParcel; import android.content.pm.IDataLoaderStatusListener; import android.os.incremental.IncrementalNewFileParams; import android.os.incremental.IStorageHealthListener; import android.os.incremental.StorageHealthCheckParams; /** @hide */ interface IIncrementalService { Loading @@ -34,7 +36,10 @@ interface IIncrementalService { * Opens or creates a storage given a target path and data loader params. Returns the storage ID. */ int openStorage(in @utf8InCpp String path); int createStorage(in @utf8InCpp String path, in DataLoaderParamsParcel params, in IDataLoaderStatusListener listener, int createMode); int createStorage(in @utf8InCpp String path, in DataLoaderParamsParcel params, int createMode, in IDataLoaderStatusListener statusListener, in StorageHealthCheckParams healthCheckParams, in IStorageHealthListener healthListener); int createLinkedStorage(in @utf8InCpp String path, int otherStorageId, int createMode); /** Loading
core/java/android/os/incremental/IStorageHealthListener.aidl 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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.incremental; /** @hide */ oneway interface IStorageHealthListener { /** OK status, no pending reads. */ const int HEALTH_STATUS_OK = 0; /* Statuses depend on timeouts defined in StorageHealthCheckParams. */ /** Pending reads detected, waiting for params.blockedTimeoutMs to confirm blocked state. */ const int HEALTH_STATUS_READS_PENDING = 1; /** There are reads pending for params.blockedTimeoutMs, waiting till * params.unhealthyTimeoutMs to confirm unhealthy state. */ const int HEALTH_STATUS_BLOCKED = 2; /** There are reads pending for params.unhealthyTimeoutMs>, * marking storage as unhealthy. */ const int HEALTH_STATUS_UNHEALTHY = 3; /** Health status callback. */ void onHealthStatus(in int storageId, in int status); }
core/java/android/os/incremental/IncrementalFileStorages.java +12 −9 Original line number Diff line number Diff line Loading @@ -65,7 +65,9 @@ public final class IncrementalFileStorages { public static IncrementalFileStorages initialize(Context context, @NonNull File stageDir, @NonNull DataLoaderParams dataLoaderParams, @Nullable IDataLoaderStatusListener dataLoaderStatusListener, @Nullable IDataLoaderStatusListener statusListener, @Nullable StorageHealthCheckParams healthCheckParams, @Nullable IStorageHealthListener healthListener, List<InstallationFileParcel> addedFiles) throws IOException { // TODO(b/136132412): sanity check if session should not be incremental IncrementalManager incrementalManager = (IncrementalManager) context.getSystemService( Loading @@ -75,9 +77,9 @@ public final class IncrementalFileStorages { throw new IOException("Failed to obtain incrementalManager."); } final IncrementalFileStorages result = new IncrementalFileStorages(stageDir, incrementalManager, dataLoaderParams, dataLoaderStatusListener); final IncrementalFileStorages result = new IncrementalFileStorages(stageDir, incrementalManager, dataLoaderParams, statusListener, healthCheckParams, healthListener); for (InstallationFileParcel file : addedFiles) { if (file.location == LOCATION_DATA_APP) { try { Loading @@ -100,7 +102,9 @@ public final class IncrementalFileStorages { private IncrementalFileStorages(@NonNull File stageDir, @NonNull IncrementalManager incrementalManager, @NonNull DataLoaderParams dataLoaderParams, @Nullable IDataLoaderStatusListener dataLoaderStatusListener) throws IOException { @Nullable IDataLoaderStatusListener statusListener, @Nullable StorageHealthCheckParams healthCheckParams, @Nullable IStorageHealthListener healthListener) throws IOException { try { mStageDir = stageDir; mIncrementalManager = incrementalManager; Loading @@ -117,10 +121,9 @@ public final class IncrementalFileStorages { mDefaultStorage.bind(stageDir.getAbsolutePath()); } else { mDefaultStorage = mIncrementalManager.createStorage(stageDir.getAbsolutePath(), dataLoaderParams, dataLoaderStatusListener, IncrementalManager.CREATE_MODE_CREATE | IncrementalManager.CREATE_MODE_TEMPORARY_BIND, false); dataLoaderParams, IncrementalManager.CREATE_MODE_CREATE | IncrementalManager.CREATE_MODE_TEMPORARY_BIND, false, statusListener, healthCheckParams, healthListener); if (mDefaultStorage == null) { throw new IOException( "Couldn't create incremental storage at " + stageDir); Loading
core/java/android/os/incremental/IncrementalManager.java +7 −3 Original line number Diff line number Diff line Loading @@ -110,11 +110,15 @@ public final class IncrementalManager { */ @Nullable public IncrementalStorage createStorage(@NonNull String path, @NonNull DataLoaderParams params, @Nullable IDataLoaderStatusListener listener, @NonNull DataLoaderParams params, @CreateMode int createMode, boolean autoStartDataLoader) { boolean autoStartDataLoader, @Nullable IDataLoaderStatusListener statusListener, @Nullable StorageHealthCheckParams healthCheckParams, @Nullable IStorageHealthListener healthListener) { try { final int id = mService.createStorage(path, params.getData(), listener, createMode); final int id = mService.createStorage(path, params.getData(), createMode, statusListener, healthCheckParams, healthListener); if (id < 0) { return null; } Loading