/* * Copyright (C) 2022 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.app.sdksandbox; import android.annotation.NonNull; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; // TODO(b/239403323): Add unit tests for this class. /** * Class to encapsulate change in {@link SharedPreferences}. * *
To be used for passing updates to Sandbox for syncing data via {@link * SharedPreferencesSyncManager#syncData()}. * *
Each update instance contains a list of {@link SharedPreferencesKey}, which are the keys whose * updates are being sent over with this class. User can get the list using {@link * #getKeysInUpdate}. * *
The data associated with the keys are sent as a {@link Bundle} which can be retrieved using
* {@link #getData()}. If a key is present in list returned in {@link #getKeysInUpdate} but missing
* in the {@link Bundle}, then that key has been removed in the update.
*
* @hide
*/
public final class SharedPreferencesUpdate implements Parcelable {
private final ArrayList